結果 : how to implement algorithm in python