# My Triangle, classes return False

#1

I am working on the my_triangle class exercise, and my code is returning “False” when indeed the 3 angles do sum up to 180 and should return True.

Here is the code:

Thanks for all your help, I am making so much progress.

Eric

#2

Check this statement …

``````    if (self.angle1 + self.angle1 + self.angle3 == 180):
``````

You are referring to `self.angle1` twice.

Also proofread the `__init__` method.

#3

The errors of looking at the screen for too many hours and copy-paste! Thank you so much.

Eric

#4

In the next part, when doing the child class Class Equilateral that inherits from parent Class Triangle, what is the difference between:

class Equilateral(Triangle):
def init(self, angle):
self.angle = 60
self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle
and…

``````self.angle = self.angle1
self.angle = self.angle2
self.angle = self.angle3
``````

(i inverted which angle comes first)

Thanks

Eric

#5

The purpose of this assignment statement is to create a class variable, `angle`, therefore it should be moved to the line prior to the `__init__` method …

``````  angle = 60
``````

The above reflects the fact that in an equilateral triangle, all of the internal angles are 60°. Consistent with that, the `__init__` method needs to set all three of the instance variables that represent these angles to `60`. The following three assignment statements within the `__init__` method accomplish that task …

``````    self.angle1 = self.angle
self.angle2 = self.angle
self.angle3 = self.angle
``````

In the above, `self.angle` accesses the class variable that was assigned `60` in order to assign that value to the three instance variables.

Edited on October 19, 2018 to clarify the discussion of the values that were assigned to the variables.