I wrote this simple permutations generator in Python 3. The permuted digits are a string, and the function should yield successive strings as well. The function returns nothing. Could I please ask for some help with this?
def permutations(digits):
if digits:
for d in digits:
remaining = digits.replace(d,"")
for p in permutations(remaining):
yield d+p
print(list(permutations("12345")))