I'm trying to write a recursive function to print some sort of permutations in python. However I get maximum depth error for some reason.
def perm(chars, k, word):
if k == 0:
print(word)
for char in chars:
perm(chars, k - 1, char + word)
perm(['1','2'], 2, '')
Anyone has any idea what the error is?