from itertools import product def gen(l): return product(*map(range, l)) print(list(gen([1, 2, 3])))
Standard input is empty
[(0, 0, 0), (0, 0, 1), (0, 0, 2), (0, 1, 0), (0, 1, 1), (0, 1, 2)]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!