Class it Up


Oops, try again. It looks like your Triangle class doesn't have a number_of_sides member variable.

Replace this line with your code. 

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


i think i have to initiate it that way
number_of_sides=Triangle(3) but still same error


Your class should have that attribute, not the instances themselves (the instances will fall back to the class's attributes, so setting the attribute on the class means that all instances will fall back to it, meaning that they'll all share the same value)

Triangle(3) returns a Triangle object (assuming that it doesn't crash, which it will, because you need more arguments for your definition of __init__ which currently wants three arguments, excluding the instance itself)
and setting number_of_sides to a Triangle object is quite something else from what's asked for


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