← Back to Classes
Question 503
Enrol In The Course
Enrol In The Course
A Course is not a kind of Student, so it does not inherit from it; instead it HAS a list of students in the attribute students. Write the body of enrol so it appends the given student object to that list. Do NOT write a main block or any top-level test code; the tests construct the class. Input: two lines, each a name, which the tests turn into Student objects and enrol in order; they then print how many students the course holds, then each name on its own line.
Expected Output:
2 Maya Omar
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Classes
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.