CJCoding With Joseph
15free / daySign inCreate account

Top Of The Course

Write two classes from scratch. Student(name, grades) stores name and grades (a list of floats) and has average() returning sum(self.grades) / len(self.grades). Course(code) does not inherit from Student; it stores code and an empty list attribute students. enrol(student) appends a Student; class_average() returns the mean of every enrolled student's average(); top_student() returns the name of the student with the highest average, keeping the best seen so far while looping. Do NOT write a main block or any top-level test code; the tests construct the class. Input: two lines, a name and then grades separated by spaces, which the tests read (the grades as floats) and enrol as a third student after Maya (88, 92, 75) and Omar (60, 70, 80, 90); they then print how many students are enrolled, the class average and the top student's name on separate lines.

Expected Output:

3
85.0
Noor

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
Classes
📥 Auto-Input:
Noor\n90 95 100\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.