Example #1
0
Jimmy = Student("Jimmy", "Johnson", "@awesome1", "Cohort 40")
Ashley = Student("Ashley", "Riker", "@awesome2", "Cohort 41")
Brian = Student("Brian", "Knoles", "@awesome3", "Cohort 42")
Eve = Student("Eve", "Nelson", "@awesome4", "Cohort 40")

# Problem: Eve.add_exercises()
students = [Jimmy, Ashley, Brian, Eve]
students = list(students)

# Problem: Create 3, or more, instructors and assign them to one of the cohorts.
Joe = Instructor("Joe", "@instructor1", "Cohort 40", "Voices")
Bryan = Instructor("Bryan", "@instructor2", "Cohort 41", "Dad Jokes")
Sage = Instructor("Sage", "@instructor3", "Cohort 42", "getting banned")

# Problem: Have each instructor assign 2 exercises to each of the students
Joe.add_exercises(Eve, [exercise1, exercise2])
Bryan.add_exercises(Jimmy, [exercise2, exercise3])
Sage.add_exercises(Ashley, [exercise3, exercise4])
Joe.add_exercises(Brian, [exercise1, exercise2])

# Chapt 14 challenge


def challenge_str(student):
    # for exercise in student.exercises:

    print(
        f"{student.first_name} is working on {student.exercises[0].name} and {student.exercises[1].name}"
    )

Example #2
0
    print(f" * {person.first_name} {person.last_name}")

sage = Instructor("Sage", "Houchens", "mshouchens", "dry humor", c10)
bryan = Instructor("Bryan", "Neilsen", "hiBry", "high fives", c40)
steve = Instructor("Steve", "Brownlee", "coach", "dad jokes", c41)

c10.students.extend([joe, ])
c40.students.extend([mike, ])
c41.students.extend([marge, jane])

c10.instructors.extend([sage])
c40.instructors.extend([bryan])
c41.instructors.extend([steve])

print(mike)
sage.add_exercises(marge, [kennel, kandy_korner])
bryan.add_exercises(joe, [kennel, c_m])
steve.add_exercises(jane, [critters, c_m])
steve.add_exercises(mike, [critters, c_m])

for exer in mike.exercise:
    print(f"Mike is currently working on {exer.name}.")


# for student in students:
#     print(f'{student.first_name} {student.last_name} is currently working on')
#     empty=""
#     for work in student.exercise:
#         empty+= work.name + " and "
#     print(empty)
count = Instructor("Count", "von Count", "1234", "counting ah ah ah", c40)
andre = Instructor("Andre", "3000", "BoB", "Ice Cold", c41)

c37.students.extend([
    dwight,
])
c40.students.extend([reptar, capn])
c41.students.extend([
    puig,
])

c37.instructors.extend([tony])
c40.instructors.extend([count])
c41.instructors.extend([andre])

tony.add_exercises(dwight, [cthulu, glassdale])
count.add_exercises(reptar, [kandy_korner, critters])
count.add_exercises(capn, [critters, glassdale])
andre.add_exercises(puig, [kandy_korner, critters])

students = [dwight, reptar, puig, capn]
for person in students:
    print(f"{person.first_name} {person.last_name}")

for work in exercises:
    print(f"{work.name} uses {work.language}.")


def print_report():
    for student in students:
        exercises = []