from itertools import product def gen(l): return map(list, 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!