def test_grade_report(): ug1 = UG('Jane Doe', 2021) ug2 = UG('Pierce Addison', 2041) ug3 = UG('David Henry', 2003) g1 = Grad('Billy Buckner') g2 = Grad('Bucky F. Dent') six_hundred = Grades() six_hundred.add_student(ug1) six_hundred.add_student(ug2) six_hundred.add_student(g1) six_hundred.add_student(g2) for s in six_hundred.get_students(): six_hundred.add_grade(s, 75) six_hundred.add_grade(g1, 25) six_hundred.add_grade(g2, 100) six_hundred.add_student(ug3) # No grades print(grade_report(six_hundred)) print() grades_list = grade_report_list(six_hundred) for entry in grades_list: print(entry) print()
def test_add_student(): # Code from page 197 course = Grades() course.add_student(Grad('Bernie Sanders')) course.add_student(Grad('Adam Grant')) # Iterate each element for s in course.get_students(): print(s) print() # Store in generator and iterate students = course.get_students() for s in students: print(s)
def main(): s1 = UG("Andrew Fu", 2020) s2 = UG("Rachel Song", 2020) s3 = UG("Alvie Stoddard", 2021) s4 = Grad("Matt Damon") s5 = UG("Mark Zuckerberg", 2019) p1 = Professor("Zhi Li", 'MIS 3640') p2 = Professor("Shankar", 'MIS 3690') p3 = BabsonPerson("Steve Gordon") q1 = Person("Bill Gates") q2 = Person("Beyonce") student_list = [s1, s2, s3, s5, s4] babson_list = student_list + [p1, p2, p3] all_list = babson_list + [q1, q2] # for everyone in student_list: # print(everyone) # for everyone in babson_list: # print(everyone) # print(everyone.speak("Happy holidays!")) for everyone in all_list: print(everyone)
def test_get_students_above(): ug1 = UG('Jane Doe', 2021) ug2 = UG('Pierce Addison', 2041) ug3 = UG('David Henry', 2003) g1 = Grad('Billy Buckner') g2 = Grad('Bucky F. Dent') six_hundred = Grades() six_hundred.add_student(ug1) six_hundred.add_student(ug2) six_hundred.add_student(g1) six_hundred.add_student(g2) for s in six_hundred.get_students(): six_hundred.add_grade(s, 75) six_hundred.add_grade(g1, 25) six_hundred.add_grade(g2, 100) six_hundred.add_student(ug3) # No grades for s in six_hundred.get_students_above(70.0): print(s)
def main(): ug1 = UG("Krishna Ammini", 2020) ug2 = UG("Emely Cedano", 2020) ug3 = UG("Demi Chu", 2019) ug4 = UG("Nico Paik", 2020) g1 = Grad("Matt Damon") g2 = Grad("Ben Affleck") mis3640 = Grades() mis3640.addStudent(g1) mis3640.addStudent(ug2) mis3640.addStudent(ug1) mis3640.addStudent(g2) mis3640.addStudent(ug4) mis3640.addStudent(ug3) mis3640.addGrade(g1, 100) mis3640.addGrade(g2, 25) mis3640.addGrade(ug1, 95) mis3640.addGrade(ug2, 85) mis3640.addGrade(ug3, 75) print("after first test:") print(gradeReport(mis3640)) mis3640.addGrade(g1, 90) mis3640.addGrade(g2, 45) mis3640.addGrade(ug1, 80) mis3640.addGrade(ug2, 75) print() print("after second test:") print(gradeReport(mis3640)) for student in mis3640.students: print(student.speak("I am excited to see the results!"))
def main(): ug1 = UG("Kenzi Fukuda", 2020) ug2 = UG("Ray Hu", 2020) ug3 = UG("Ivy Zhang", 2020) ug4 = UG("Alvie Stoddard", 2021) g1 = Grad("Matt Damon") g2 = Grad("Ben Affleck") mis3640 = Grades() mis3640.add_student(g1) mis3640.add_student(ug2) mis3640.add_student(ug1) mis3640.add_student(g2) mis3640.add_student(ug4) mis3640.add_student(ug3) mis3640.add_grade(g1, 100) mis3640.add_grade(g2, 25) mis3640.add_grade(ug1, 95) mis3640.add_grade(ug2, 85) mis3640.add_grade(ug3, 75) print("after first test:") print(gradeReport(mis3640)) mis3640.add_grade(g1, 90) mis3640.add_grade(g2, 45) mis3640.add_grade(ug1, 80) mis3640.add_grade(ug2, 75) print() print("after second test:") print(gradeReport(mis3640)) for student in mis3640.students: print(student.speak("I am excited to see the results!"))
def main(): ug1 = UG("Shoaib Rahaman", 2021) ug2 = UG("Anna Zhang", 2022) ug3 = UG("Palida Prasitanond", 2022) ug4 = UG("Susanna A D'Souza", 2020) g1 = Grad("Matt Damon") g2 = Grad("Ben Affleck") mis3640 = Grades() mis3640.add_student(g1) mis3640.add_student(ug2) mis3640.add_student(ug1) mis3640.add_student(g2) mis3640.add_student(ug4) mis3640.add_student(ug3) mis3640.add_grade(g1, 100) mis3640.add_grade(g2, 25) mis3640.add_grade(ug1, 95) mis3640.add_grade(ug2, 85) mis3640.add_grade(ug3, 90) print("after first test:") print(gradeReport(mis3640)) mis3640.add_grade(g1, 90) mis3640.add_grade(g2, 45) mis3640.add_grade(ug1, 80) mis3640.add_grade(ug2, 100) print() print("after second test:") print(gradeReport(mis3640)) for student in mis3640.students: print(student.speak("I am excited to see the results!"))
def main(): ug1 = UG('Jonathan Beltran', 2019) ug2 = UG('Waylon Ryan', 2019) ug3 = UG('Allison Fernandez', 2019) ug4 = UG('Pranjal Joshi', 2019) g1 = Grad('Matt Damon') g2 = Grad('Ben Affleck') mis3640 = Grades() mis3640.addStudent(g1) mis3640.addStudent(ug2) mis3640.addStudent(ug1) mis3640.addStudent(g2) mis3640.addStudent(ug4) mis3640.addStudent(ug3) mis3640.addGrade(g1, 100) mis3640.addGrade(g2, 25) mis3640.addGrade(ug1, 95) mis3640.addGrade(ug2, 85) mis3640.addGrade(ug3, 75) print(gradeReport(mis3640)) mis3640.addGrade(g1, 90) mis3640.addGrade(g2, 45) mis3640.addGrade(ug1, 80) mis3640.addGrade(ug2, 75) print() print('after second test:') print(gradeReport(mis3640)) for student in mis3640.students: print(student.speak('I am excited to see the results!'))
def main(): s1 = UG('Christian Thompson', 2019) s2 = UG('Sarah Zazyczny', 2019) s3 = UG('Zirui Jiao', 2020) s4 = Grad('Matt Damon') s5 = UG('Mark Zuckerberg', 2019) p1 = BabsonPerson('Zhi Li') p2 = BabsonPerson('Shankar') p3 = BabsonPerson('Steve Gordon') q1 = Person('Bill Gates') q2 = Person('Beyonce') studentList = [s1, s2, s3, s5, s4] BabsonList = studentList + [p1, p2, p3] allList = BabsonList + [q1, q2] # for everyone in studentList: # print(everyone) for everyone in BabsonList: print(everyone) print(everyone.speak('Happy holidays!'))
def main(): s1 = UG("Arteen Zahiri", 2020) s2 = UG("Shirley Ying", 2020) s3 = UG("Shaun Tan", 2021) s4 = Grad("Matt Damon") s5 = UG("Mark Zuckerberg", 2019) p1 = BabsonPerson("Zhi Li") p2 = BabsonPerson("Shankar") p3 = BabsonPerson("Steve Gordon") q1 = Person("Bill Gates") q2 = Person("Beyonce") studentList = [s1, s2, s3, s5, s4] BabsonList = studentList + [p1, p2, p3] allList = BabsonList + [q1, q2] # for everyone in studentList: # print(everyone) for everyone in BabsonList: print(everyone) print(everyone.speak("Happy holidays!"))
report= report+ '\n '\ + str(s) + '\'s mean grade is' +str(average) except ZeroDivisionError: report =report + '\n' \ +str(s)+ 'has no grades' return report if __name__ == '__main__': # ug1=UG('Faisal',2017) # ug2=UG('Shumal',2016) # ug3=UG('Henry',2015) # g1=Grad('Billy Bucker') # g2= Grad('Roy Hamot') # sixHundred= Grades() # sixHundred.addStudent(ug1) # sixHundred.addStudent(ug2) # sixHundred.addStudent(g1) # sixHundred.addStudent(g2) # for s in sixHundred.getStudents(): # sixHundred.addGrade(s,75) # sixHundred.addGrade(g1,25) # sixHundred.addGrade(g2,100) # sixHundred.addStudent(ug3) # print (Grades.gradeReport(sixHundred)) book = Grades() book.addStudent(Grad('Faisal')) book.addStudent(Grad('Shumal')) for s in book.getStudents(): print s