Question: Python class Student: def __init__(self, name, id_num, quizzes, exams): self._name = name self._id_num = id_num self._quizzes = quizzes self._exams = exams def grade(self): average_quiz_score =

Python

Python class Student: def __init__(self, name, id_num, quizzes, exams): self._name = name

self._id_num = id_num self._quizzes = quizzes self._exams = exams def grade(self): average_quiz_score

class Student: def __init__(self, name, id_num, quizzes, exams): self._name = name self._id_num = id_num self._quizzes = quizzes self._exams = exams   def grade(self): average_quiz_score = sum(self._quizzes) / len(self._quizzes) average_exam_score = sum(self._exams) / len(self._exams) course_grade = 0.25 * average_quiz_score + 0.75 * average_exam_score return course_grade 
 def class_average(students): return None 

if __name__ == '__main__': 
 s1 = Student('Jane Smith', 110837363, [90, 88, 82, 99], [80, 77]) s2 = Student('Mike Jones', 110284928, [78, 91, 50], [100, 91, 92]) s3 = Student('Abe Lincoln', 110293822, [88], [94, 78, 84, 91]) s4 = Student('Felix D. Cat', 110728365, [38, 88, 91, 77, 81], [95]) s5 = Student('Alan Turing', 110101100, [92, 99], [90, 90, 90]) 
 print('Testing class_average() for [s1, s2, s3, s4]: ' + str(class_average([s1, s2, s3, s4]))) print('Testing class_average() for [s2, s3, s4, s5]: ' + str(class_average([s2, s3, s4, s5]))) print('Testing class_average() for [s2, s5]: ' + str(class_average([s2, s5]))) 

Write a function class-average that takes a list of student objects as its argument and returns the aver age grade earned by students in the list. Note that your class-average function should call the grade method (which you wrote in Part I) on each Student object to get that student's grade in the course. Take the simple, unweighted average of all students' grades to compute the class average

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!