18. Inheritance Please help


#1
class Equilateral(Triangle):
angel = 60
def __init__(self):
    self.angel1 = self.angel
    self.angel2 = self.angel
    self.angel3 = self.angel

Oops, try again.
Did you remember to create the angle attribute for Equilateral?

What am I doing wrong?


#2

Spelling error. angle


#3

Thank you heaps, probably looked at it a hundred times


#4

help, I used the code but it doesn't work the error message I get is:
Oops, try again. Your code looks a bit off. See the console window for the full error message.
Traceback (most recent call last):
File "python", line 1, in
NameError: name 'Triangle' is not defined


#5

Curious though why are we able to call self.angle when we just declared angle in this subclass? Can anyone enlighten please?


#6

The instance is what takes on the angles, and it is of the subclass, so self is that context. We need all three angles because the check_angles method refers to all three.