Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Input
- A = [1,2,0]
- #Output
- B = [[0,0,0],
- [1,0,0],
- [1,1,0],
- [1,2,0],
- [0,1,0],
- [0,2,0]]
- >>> from itertools import product
- >>> A
- [1, 2, 0]
- >>> list(product(*[list(range(e+1)) for e in A]))
- [(0, 0, 0), (0, 1, 0), (0, 2, 0), (1, 0, 0), (1, 1, 0), (1, 2, 0)]
- >>>
Add Comment
Please, Sign In to add comment