Inheritance


#1

I can't see where I've gone wrong

Oops, try again. This part doesn't look right: ( self.angle1 = angle ) Make sure that you use the self qualifier when accessing the angle attribute of Equilateral, like this: self.angle

my_triangle = Triangle(35, 90, 55)

print my_triangle.number_of_sides
print my_triangle.check_angles()

class Equilateral(Triangle):
    angle = 60
    def __init__(self):
        self.angle1 = angle
        self.angle2 = angle
        self.angle3 = angle

These are the instructions:
Create a class named Equilateral that inherits from Triangle.
Inside Equilateral, create a member variable named angle and set it equal to 60.
Create an init() function with only the parameter self, and set self.angle1, self.angle2, and self.angle3 equal to self.angle (since an equilateral triangle's angles will always be 60˚).


#2

Hi, @cbrw ,

See the message ...

... then consider how to revise this and the other two statements that are similar to it ...

self.angle1 = angle

#3

I've just figured it out is should be:

self.angle1 = self.angle


#4