結果 : how to avoid nested for loops in python