# 18/18 please explain to me, why it doesn't works?

class Triangle(object):
def init(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
number_of_sides = 3
def check_angles(self):
if self.angle1 + self.angle2 + self.angle3 == 180:
return True
else:
return False

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

``````self.angle = self.angle1
self.angle = self.angle2
self.angle = self.angle3
``````

should be

``````self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle
``````

self.angle is already equal to 60, this is āself.angle1ā, āself.angle2ā and āself.angle3ā that you want to be equal to 60.

6 Likes

iām not sure why iām still lost in this solution, but how did angle suddenly become āselfā.angle?

Also donāt just put in:

``````def init(self)
``````

you should put in:

``````def __init__(self)
``````

hope it works!

I think this is because the:

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

Takes the argument of self. Also it says self.angle1 because you need to set the previous angle degrees to 60. Most of the previous lessons had

``````def __init__(self, #another argument here):
``````

Whereas this just has one argument: self.

1 Like

hmā¦ I have another one problem. My code is below:

``````class Triangle():
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
else:
return False

my_triangle = Triangle (90, 30, 60)
print my_triangle.number_of_sides
print my_triangle.check_angles()

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

and it throws me an error:

Oops, try again. It looks like init is missing from Equilateral AND/OR Triangle

1 Like

I entered the same code and got the same error message.

But, unless I have overlooked something, the code that you and I have entered in response to this lesson complies with the instructions given and, whatever the error message we both get may say, init is not missing from Equilateral and/or Triangle.

I can only suppose that, despite following to the letter the instructions given, we have somehow done something that the Codecademy program does not like.

Sorry, this is not much use to you. But advertising the fact more than one person has had the same problem may prompt someone else to help.

1 Like

itāseems that you forget a ā_ā in the method definition of Equilateral.
You writed def init_(self) in place of def --init-- (self)
(please replace ā by __ because i donāt know why when I write __ before init and after itās doesnāt appear in the messageā¦)

I have the same problem (I wrote init correctly):

class Triangle(object):
def init(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3

``````number_of_sides = 3

def check_angles(self):
if self.angle1+self.angle2+self.angle3 == 180:
return True
else:
False
``````

my_triangle = Triangle(90,30,60)
print my_triangle.number_of_sides
print my_triangle.check_angles()

class Equilateral(Triangle):

``````angle = 60

def __int__(self):
self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle
``````

Oops, try again. It looks like init is missing from Equilateral AND/OR Triangle. (Please help me and explain! thanks!)

int must be init

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
else:
return False
``````

my_triangle = Triangle(90,30,60)
print my_triangle.number_of_sides
print my_triangle.check_angles()

class Equilateral(Triangle):
angle = 60
angle1=angle
angle2=angle
angle3=angle
def init(self):
pass

try creating three new variables for the class equilateral itāll work

the work is āwrite a new class equilateralā in of class write a function that check if the angles
passed are egual 60 whhy em um equilateral all angle are 60 use de if statement

I have
def init(self):
self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle

I get the error ādid you remember to create the angle attribute for equilateral?ā Why?

never mind, i need angle arguments because iām redefining the init function.