The Student Module
A local high school needs a tool to help manage the academic records of its students. They have asked for a program that can calculate the average marks of a student and determine if the student has passed or failed. The passing mark is 50.
You are asked to develop a
student.py
module that defines a Student
class. Each student should have properties name
, age
, and marks
(which is a list). The Student
class should also include a method to calculate the average mark
and another method to check if the student has passed
or failed
:average_mark
: this method should return the average mark of the student.
has_passed
: this method should returnTrue
if the student's average mark is 50 or higher, andFalse
otherwise.
The
main.py
module will take care of input and output automatically.Input | Output |
student1 = Student("John", 16, [65, 80, 90]); print(student1.average_mark()); print(student1.has_passed()) | 78.33
True |
Note: For the purpose of this challenge, you only need to develop the
student.py
module, and do not need to worry about how the main.py
module will use it. Your module should correctly define the Student
class and its methods so that they work as described above.Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB