18 - Inheritance


#1



18 - Inheritance

Oops, try again.
Failed to instantiate Equilateral, an error was thrown: 'Equilateral' object has no attribute 'angle1'

i expected that Equilateral would inherit the arguments set in init for the class Triangle, which does not.
What part of my code should be re-written?


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


#2

def __init__(self):
        self.angle1 = self.angle
        self.angle2 = self.angle
        self.angle3 = self.angle

Replace the comparison operators with assignment operators :slight_smile:


#3

Alright, it was not a big stretch from the original code then, still need to work on the basics! Thanks gvm :slight_smile:


#4