################### Recursive code tracing ######################

def f(a, b):
    if a == []:
        return []
    else:
        return [a[0]] + [b[0]] + f(a[1:], b[1:])

print(f([1,2,3], [4,5,6]))

################### Recursive code writing ######################

def isPalindrome(s):
    return

assert(isPalindrome("abba") == True)
assert(isPalindrome("Dancing Queen") == False)
assert(isPalindrome("123321") == True)



def listMultiply(L):
    return

assert(listMultiply([1,2,3]) == [1,2,2,3,3,3])
assert(listMultiply([6]) == [6,6,6,6,6,6])
assert(listMultiply([1,2,3,-4]) == [1, 2, 2, 3, 3, 3])

################### Bonus: catch the error ######################

def countEvens(s):
    if s == '':
        return ''
    else:
        char = s[0]
        if char.isdigit() and int(char) % 2 == 0:
            return 1 + countEvens(s)
        else:
            return countEvens(s[1:])

assert(countEvens('12345678') == 4)
assert(countEvens('0') == 1)
assert(countEvens('abcd4ef-56') == 2)