結果 : how to avoid nested for loops python