Question 2
Back to Exercise
The program below stops with an error. Which statement correctly describes the problem?
class Employee:
def __init__(self, name):
self.name = name
class Manager(Employee):
def __init__(self, name, team):
self.team = team
m = Manager("Asha", ["Ravi"])
print(m.name, m.team)
- A It prints Asha ['Ravi']
- B TypeError
- C AttributeError: Manager.__init__ never calls super().__init__(name), so name is never set Correct
- D NameError
Correct Answer: Option C
Add super().__init__(name) as the first line of Manager.__init__.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!