In python is there an easier way to write 6 nested for loops?

后端 未结 11 1571
长情又很酷
长情又很酷 2020-12-04 17:49

This problem has been getting at me for a while now. Is there an easier way to write nested for loops in python? For example if my code went something like this

11条回答
  •  无人及你
    2020-12-04 18:39

    When faced with that sort of program logic, I would probably break up the sequence of loops into two or more separate functions.

    Another technique in Python is to use list comprehensions where possible, instead of a loop.

提交回复
热议问题