alpha = [0,1,2,3,4,5,6,7,8,9]
for a in alpha:
for b in alpha:
for c in alpha:
for d in alpha:
print str(a) + str(b) + str(c) + str(d)
The code above will generate all numbers between 0000 to 9999. However, I do not like the way the code is structured. Let's say I would want to do this to produce numbers up to a ten digit size; that would require 10 for loops. Is there another way the same result could be achieved, without having to insert countless of for loops?