#################################################
# hw9.py
#
# Note: to receive any credit on this hw, you must not use
# 'for' or 'while' loops anywhere!  Just use recursion here!
#
#################################################

def oddCount(L):
    return 42

def areNearlyEqual(L, M):
    return 42

# Hint: this dictionary may be helpful for the next exercise!
DNA_MAP = { 'A':'T', 'T':'A', 'G':'C', 'C':'G' }

def complementaryDNA(dna):
    # Hint: the DNA_MAP dictionary defined above may be helpful here!
    return 42

def nthLucasNumber(n):
    return 42

######################################################################
# bonus/optional: you can ignore the functions below here
######################################################################

def flatten(L):
    # hint: it may be helpful to use type(L) here!
    return 42

######################################################################
# ignore_rest: The autograder will ignore all code below here
######################################################################

#################################################
# Test Functions
#################################################

def testOddCount():
    print('Testing oddCount()...', end='')
    assert(oddCount([ 2 ]) == 0)
    assert(oddCount([ 2, 3, 4 ]) == 1)
    assert(oddCount([ 2, 3, 4, 5 ]) == 2)
    assert(oddCount([ 2, 3, 4, 5, 6, 7, 7, 7 ]) == 5)
    assert(oddCount([ ]) == 0)
    print('Passed')

def testAreNearlyEqual():
    print('Testing areNearlyEqual()...', end='')
    assert(areNearlyEqual([1, 2, 3], [1, 2, 3]) == True)
    assert(areNearlyEqual([1, 2, 3], [2, 3, 4]) == True)
    assert(areNearlyEqual([2, 3, 4], [1, 2, 3]) == True)
    assert(areNearlyEqual([1, 2, 3], [2, 3, 4.1]) == False)
    assert(areNearlyEqual([1, 2, 3, 4], [2, 3, 4]) == False)
    assert(areNearlyEqual([1], [ ]) == False)
    assert(areNearlyEqual([ ], [ ]) == True)
    print('Passed!')

def testComplementaryDNA():
    print('Testing complementaryDNA()...', end='')
    assert(complementaryDNA('ATGC') == 'TACG')
    assert(complementaryDNA('ATGCCGTA') == 'TACGGCAT')
    assert(complementaryDNA('A') == 'T')
    assert(complementaryDNA('') == '')
    print('Passed')

def testNthLucasNumber():
    print('Testing nthLucasNumber()... ', end='')
    assert(nthLucasNumber(0) == 2)
    assert(nthLucasNumber(1) == 1)
    assert(nthLucasNumber(2) == 3)
    assert(nthLucasNumber(3) == 4)
    assert(nthLucasNumber(4) == 7)
    print('Passed!')

def bonusTestFlatten():
    print("Testing bonus: flatten()...", end="")
    assert(flatten([1,[2]]) == [1,2])
    assert(flatten([1,2,[3,[4,5],6],7]) == [1,2,3,4,5,6,7])
    assert(flatten(['wow', [2,[[]]], [True]]) == ['wow', 2, True])
    assert(flatten([]) == [])
    assert(flatten([[]]) == [])
    assert(flatten(3) == 3)
    print("Passed!")

#################################################
# testAll and main
#################################################

def testAll():
    testOddCount()
    testAreNearlyEqual()
    testComplementaryDNA()
    testNthLucasNumber()
    # bonusTestFlatten()

if __name__ == '__main__':
    testAll()
