Write a class named `Person` that has the following instance attributes

Write a class named `Person` that has the following instance attributes:

`name`: name of the person

In addition, the `Person` class should have the following methods:

`__init__` method that accepts a name as the argument and assigns it to the instance’s `name` attributes.

Write a class named `Student` that inherits from the `Person` class. The `Student` class has a new instance attribute:

`score`: the score of the student, the default value is 60

In addition, the Student class should have the following methods:

`__init__` method that accepts a name and a score as arguments. These values should be assigned to the instance’s `name` and `score` attributes.

`set_score`: an instance method that accepts an argument and assigns it to the instance attribute `score`.

`get_score`: an instance method that returns the instance attribute `score`.

Write a class named `School` that has the following class attribute:

`students`: a list

In addition, the `School` class should have the following class method:

`add_student`: a class method that appends a `Student` instance to the class attribute `students`.

example:

>>> s1 = Student(“Tom”, 80)

>>> s2 = Student(“Jerry”)

>>> School.add_student(s1)

>>> School.add_student(s2)

>>> print(School.students[0].score)

>>> print(School.students[1].score)

80
60

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?