Finding all combinations of a list in Python with repetition
问题 I am looking to find and print all possible combinations of the set (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) of length 5. There should be 13 choose 5 combinations (6188) because order does NOT matter, and repetition is allowed. I found this code and was using it: from itertools import product for item in product([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], repeat=5): print(item) However, this is not printing all 6188 combinations. Trying to figure out how to tweak the code so it spits out