Class Results
Python
25 pts
Class Results
Create a class Student with __init__(self, name, mark) and a __str__ that returns Name: mark, for example Selam: 88.
- Create a list called
studentswith three objects: Selam (88), Merhawi (72) and Abel (65), in that order. - Abel did extra homework: add 5 to his mark by changing the attribute of the object in the list (do not create a new object).
- Loop over the list and print every student.
Expected output:
Selam: 88 Merhawi: 72 Abel: 70
Checklist
- Define a class
Studentwith__init__(self, name, mark)and a__str__that returnsName: mark. - Create a list called
studentswith Selam (88), Merhawi (72) and Abel (65), in that order. - Add 5 to Abel's mark by changing the object in the list.
- Loop over the list and print every student.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
