# Inheritance Syntax

class Triangle(Shape):
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
``````

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

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

What am I doing wrong?? Ive been manipulating this for an hour now…

NVM, as soon as I asked I figured it out… of course

What was the cause of the problem?

“Oops, try again. init in Equilateral should take one argument: self” my code is following, pls help
class Triangle(object):
#initiative process
def init(self,angle1,angle2,angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
number_of_sides = 3
#define a method
def check_angles(self):
if self.angle1+self.angle2+self.angle3 == 180:
return True
else:
return False
my_triangle = Triangle(90,45,45)
print my_triangle.number_of_sides
print my_triangle.check_angles()
#inheritance
class Equilateral(Triangle):
angle = 60
def init(self,angle1,angle2,angle3):
self.angle1=self.angle
self.angle2=self.angle
self.angle3=self.angle

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

Thank you！！it works, but I can’t understand why init(self) instead of (self, args1, args2,args3)

Hi, I tried different ways in ipython all OK but codecadmy is more restrict. Good luck.

I am getting this error, “It looks like init is missing from Equilateral AND/OR Triangle.”

is there anything wrong with my code?

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):
sum = self.angle1+self.angle2+self.angle3
if sum ==180:
return True
else :
return False
``````

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

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