def factorial(x):
    print(x)
    if x == 1: # base case is the smallest value
        print("->", 1)
        return 1 # something that isn't recursive
    else:
        smallerProblem = x - 1 # make the problem smaller
        smallerResult = factorial(smallerProblem)
        print("->", x*smallerResult)
        return x * smallerResult # combine with the leftover part

print(factorial(5))
#print(factorial(0))

###

def countVowels(s):
    print(s)
    if s == "": # base case
        print("->", 0)
        return 0
    else: # recursive case
        smaller = countVowels(s[1:])
        if s[0] in "AEIOUaeiou":
            print("->", smaller+1)
            return smaller + 1
        else:
            print("->", smaller)
            return smaller

print(countVowels("apple"))

###

def removeDuplicates(lst):
    if lst == []: # base case
        return []
    else: # recursive case
        smaller = removeDuplicates(lst[1:]) # [1, 2, 3, 4]
        if lst[0] in smaller:
            return smaller
        else:
            return [lst[0]] + smaller

print(removeDuplicates([5, 2, 1, 2, 3, 4, 3, 3]))