結果 : how to avoid nested loops in python