class Triangle(object):
    number_of_sides = 3
    def __init__(self, angle1, angle2, angle3):
        self.angle1 = angle1
        self.angle2 = angle2
        self.angle3 = angle3
    def check_angles(self):
        if self.angle1+self.angle2+self.angle3 == 180:
            return True
            return False
class Equilateral(Triangle):
    angle = 60
    def __init__(self):
        self.angle1 = angle
        self.angle2 = angle
        self.angle3 = angle
my_triangle = Triangle(90,30,60)
print my_triangle.number_of_sides
print my_triangle.check_angles()

"Oops. 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"

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˚).

What am i missing?


Got it, never mind :smiley:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.