Is there a more elegant way of getting permutations with replacement in python?
Is there a more elegant way of getting permutations with replacement in python? Question: I currently want all permutations of a set of elements with replacement. Example: elements = [‘a’, ‘b’] permutations with replacement = [(‘a’, ‘a’, ‘a’), (‘a’, ‘a’, ‘b’), (‘a’, ‘b’, ‘a’), (‘a’, ‘b’, ‘b’), (‘b’, ‘a’, ‘a’), (‘b’, ‘a’, ‘b’), (‘b’, ‘b’, …