Python recursion with list returns None [duplicate]

You don’t return anything in the else clause:

    else:
        return foo(a)

Leave a Comment