結果 : how to optimize nested for loop in python