結果 : how to write an iterative function in python