You need to implement something like this:
def func(n): for x in range(0, 10): for y in range(0, 10): # здесь ещё несколько вложенных циклов for z in range(0, 10): print x, y, ..., z
Those. the total must be n variables (from x to z).
You need to implement something like this:
def func(n): for x in range(0, 10): for y in range(0, 10): # здесь ещё несколько вложенных циклов for z in range(0, 10): print x, y, ..., z
Those. the total must be n variables (from x to z).
for mas in itertools.product(*[range(0, 10) for i in range(n)]): print(mas)
n
? - VladD > print x, y, ..., z
There is nothing in the alphabet between 'y' and 'z' :)
And on the topic: use recursion.
Source: https://ru.stackoverflow.com/questions/239836/
All Articles