0

Meta-Programming for Nested For Loop Generation

My fellow coders, In trying to create my most recent sequence generator I have hit a wall in terms of my knowledge of more advanced Python topics. My question is this: I need to write a piece of code that generates and then runs a nested For Loop that is nested a specified number of times (and each with a unique index counter like i, j, k, etc). In doing some cursory research I came across meta-programming and was wondering how to use it to solve my current predicament. Thank you all for your time.

23rd Aug 2020, 2:43 AM
Pythagoras
Pythagoras - avatar
2 ответов
+ 1
Nested for loops can do it
23rd Aug 2020, 12:21 PM
KnightDeluxe12
KnightDeluxe12 - avatar
0
I know that I can just write several nested for loops, but what I need is something more like this: for i in range(x) for j in range(x) for k in range(x) for m ... I need to do this without writing the nested for loops myself.
23rd Aug 2020, 4:35 PM
Pythagoras
Pythagoras - avatar