18/19, I seem to be close, but no cigar


#1

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
def init(self):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
def equal_angles(self):
if self.angle1 + self.angle2 + self.angle3 == self.angle:
return true
else:
return false

Oops, try again. Failed to instantiate Equilateral, an error was thrown: global name 'angle1' is not defined


#2

Also I get in the console: 3 True None


#3

ok, I did get this after all

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
def init(self):
self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle


#4

Thank you for your help, I was typing in the opposite way the following section
self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle

I was typing
self.angle = self.angle1
self.angle = self.angle2
self.angle = self.angle3

After the adjustment my code finally works!