When recursively passing this string into this counting function, and declaring a set as a mutable function parameter to keep track of the results through the recursion, everything seems to work fine when stepping through with a debugger (and also by the print statements in the end test case), however the return result is None. What's going on here that's causing that?
def count_ways(data, l = set()):
if len(data) == 0:
print(l) # Shows my set has stuff
print(len(l)) # Shows my set has length
return(len(l)) # Why is None being returned?!
one_dig = int(data[:1])
two_digs = int(data[:2])
if (one_dig > 0):
l.add(one_dig)
if (10 <= two_digs <= 26):
l.add(two_digs)
count_ways(data[1:])
print(count_ways("124136"))