For a course I am making a program that must involve recursion. This is what I have so far:
def words(letters, start, word):
while (start) < (len(letters)):
word = word + letters[start]
print(word)
letters = letters.replace(letters[start], "")
start = (words(letters, start, word))
return (start + 1)
The goal of the program is to accept a list of letters and output all possible combinations of those letters. I am not sure if the program will work, but before that, I am running into another issue. When I run this with a basic command, e.g.
words("abcd", 0, "")
(the 0 and the "" are just for starting off the command as they are necessary in the future). But when I run that, it outputs, a ab abc abcd, but then stops with an error citing the line return(start + 1) saying the start is not an integer, but a None type. When did start become a None type? And how can I keep it as an integer?