###############################################################################
# --------------- 15-112 Recitation Week 9: OOP & Recursion ---------------- #

# This is a starter file of the problems we did in recitation. A good way to
# use this file is to try to re-write problems you saw in recitation from
# scratch. This way, you can test your understanding and ask on Piazza or
# office hours if you have questions :)

# --------------------------------------------------------------------------- #
###############################################################################
# Student Classes
###############################################################################
'''
define class(es) so that testStudentOOP will pass! Make sure to use inheritance
properly!
'''


class Student(object):
    pass


def testStudentOOP():
    print("Testing Student Classes...", end="")
    chaya = Student("Chaya", "Comp Bio")
    chaya.addClass("76-100")

    kyle = OneTwelveStudent("Kyle", "IS", "JJ")
    kyle.addClass("76-100")

    assert(chaya.classes == set(['76-100']))
    assert(kyle.classes == set(['15-112', '76-100']))

    arman = Student("Arman", "ECE")
    kdchin = OneTwelveStudent("Kyle", "IS", "DD")

    assert(chaya != arman)
    assert(kyle != kdchin)
    assert(type(arman) == Student)
    assert(type(kyle) == OneTwelveStudent)
    assert(isinstance(kyle, Student))

    x = 5
    try:
        chaya.get112Grade()
    except:
        x = 4
    assert(x == 4)
    assert(kyle.get112Grade() == 42)
    kyle.study112()
    assert(kyle.get112Grade() == 42 + 42)

    assert(sorted(str(Student.students)) == sorted(
        "{Student named Chaya, OneTwelveStudent named Kyle, Student named Arman, OneTwelveStudent named Kyle}"))

    assert(sorted(str(OneTwelveStudent.students)) == sorted(
        "{OneTwelveStudent named Kyle, OneTwelveStudent named Kyle}"))

    assert(OneTwelveStudent.getSchool() == "Carnegie Mellon")
    print("Passed!")


###############################################################################
# Recursive Reverse
###############################################################################
'''
Write the function reverse(s) using recursion (no loops fancy slicing!) in several
different ways:
1) Head and tail (reverse characters 1 to n-1, then put the first one at the end)
    "abcd" --> "a" "dcb" --> "dcba"
2) Split down the middle aka "divide and conquer" (reverse each half and combine)
    "abcd" --> "ba" "dc" --> "dcba"
3) With a stack trace!
'''


def reverseHeadTail(s):
    return "42"


def reverseDivideAndConquer(s):
    return "42"


def testReverse():
    print("Testing Reverse...", end="")
    # you can put your test cases here :)
    print("Passed!")
