Https://www.codecademy.com/courses/learn-python/lessons/introduction-to-classes/exercises/class-it-up

Dear fellow colleagues,

l am getting an indentation error in the code below but it seems correct to me,kindly assist

class Triangle(object):

  def __init__(self,angle1,angle2,angle3):

    self.angle1 = angle1

    self.angle2 = angle2

    self.angle3 = angle3

number_of_sides  = 3

  def check_angles(self):

    if sum(self.angle1,self.angle2,self.angle3) == 180:

      return True

    else:

      return False

Thank you
Jagmeet

It has been 10 minutes since you last needed help. Have you tried debugging this issue? Like check the lines before the error as well.

Don’t get me wrong, we like to help, but I also want to make you aware that learning to debug is a valuable skill you will need as a developer. You could ask yourself questions like: What could cause this error?

You could temporary turn parts of your code in comment for example, to see if this can narrow down the problem.

I downloaded pycharm and removed the indentation in worked

thank you

class Triangle(object):

    def __init__(self,angle1,angle2,angle3):

        self.angle1 = angle1

        self.angle2 = angle2

        self.angle3 = angle3

number_of_sides  = 3

def check_angles(self):

        if sum (self.angle1,self.angle2,self.angle3) == 180:

                return True

        else:

                return False

but now number_of_sides isn’t a class property, its just a global variable

check_angle is no longer a method. If we try to create a class instance:

triangle = Triangle(60, 60, 60)
print( triangle.check_angles() )

that should work if your code work correct

furthermore, sum() is a builtin function for an iterable object like a list.