I am trying to create a set of test cases for a project that I am working on, and I would like to create all possible test cases and iterate over them (fast program, it won't take much time). All test cases should be a list of length 1-4, and each element in the list should be an integer from 0 to 10 inclusive. The first element in the list should be 0. Then the list of lists will be as follows:
[0] [0,0] [0,1] [0,2] [0,3] ... [0,10] [0,0,0] [0,0,1] [0,0,2] [0,0,3] ... [0,1,0] [0,1,1] [0,1,2] ... [0,10,10] ... [0,10,10,10]
This is what I have so far, but it does not list the correct lists:
test_list = [0] for length in range(2, 5): while len(test_list) < length: test_list.append(0) for position in range(1, length): for digit in range (0, 11): test_list[position] = digit print test_list
source share