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).

  • one
    @Kinky and who's stopping? (I like questions, where the condition of the problem contains obvious non - sayings ) - alexlz 6:08 pm
  • It is not the first question, where they are trying to invest N cycles into each other. The previous speaker wanted to embed N infinite cycles. - atwice

3 answers 3

 for mas in itertools.product(*[range(0, 10) for i in range(n)]): print(mas) 
  • one
    great, but for arbitrary n ? - VladD
  • one
    for mas in itertools.product (* [range (0, 10) for i in range (n)]): print (mas) - DmitriyM
  • one
    cool, well , put in the answer - VladD

I do not know Python, so pseudocode:

 vars = array(n) do print vars # find the index to increase for (index = 0; index < n && ++vars[index] == 10; ++index) vars[index] = 0 while (index < n) 

In general, it was already ( one , two ).

     > print x, y, ..., z 

    There is nothing in the alphabet between 'y' and 'z' :)

    And on the topic: use recursion.