I just started learning python and have run into a problem in my current project. I am trying to loop through an array to check every possible combination of the array within a certain range. The problem is that the length of the array is going to change based on a user input so I can't just write a loop for every index in the array. Does anyone have any tips for how to write this?
For example, if it had a length of 2 and I wanted it to count from 0 to 3 I would want it to loop through and print out:
[0, 0] [0, 1] [0, 2] [0, 3] [1, 0] [1, 1] [1, 2] [1, 3] [2, 0] [2, 1] [2, 2] [2, 3] [3, 0] [3, 1] [3, 2] [3, 3]
I don't need it to print them all out on a single line but I just need for the loop or module to give me all of the outputs at some point.
And I could even have it go out to length 10 or something, idk yet. I have most of the code for the rest of the program done too, just need this one thing.
Last edited by micseydel
on Wed Jan 08, 2014 9:05 am, edited 1 time in total.
Reason: Locked OP.