Class it up


#1



https://www.codecademy.com/en/courses/python-intermediate-en-WL8e4/3/2?curriculum_id=4f89dab3d788890003000096#


It says:
Oops, try again. It looks like your check_angles method doesn't return True for valid triangle angle values.


Could you guys please tell me where am I wrong?


class Triangle(object):
    """Make Triangles!"""
    def __init__(self, angle1 ,angle2 ,angle3):
        Triangle.angle1 = angle1
        Triangle.angle2 = angle2
        Triangle.angle3 = angle3
    
    def check_angles(self):
        if (self.angle1+self.angle2+self.angle3 == 180):
            return True
        else:
            return False
            
    number_of_sides = 3
    
T = Triangle(25,25,130)
print T.check_angles()


#2

the problem is in __init__(), could you explain your thinking about this line:

Triangle.angle1 = angle1

#3

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