Class it up


#1



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


Your code caused the following error: 'Triangle' object has no attribute 'angle1'


I don't know what's wrong, it seems correct, please help.

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


#2

Consider whether you should have set such an attribute.
If not, then you shouldn't read what you shouldn't have set, right?
If yes, then this would indicate that you didn't and would therefore need to do something about that.

Also, please return the result of the boolean expression instead of using an if-statement to return True/False which is kind of redundant when you already have that value from the expression (code style, somewhat opinionated)


#3

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