結果 : how to implement dynamic programming in python