No worries, classes can be a confusing concept. The
__init__ method is known as a constructor which 1) defines the way that the class may be instantiated, and 2) is run once when the class is instantiated (created).
self refers to the class instance itself. Some languages opt to use the keyword
this for that purpose. In some other languages, the presence of
this is implied for methods within a class. In Java, for example, everything is an object and therefore
this' presence can be implied when working within almost any situation.
I digress. Python's requirement to include
self as the first argument to a method is a design choice of the language.
Anyway, looking at your code your
__init__ method takes in the argument list self, angle1, angle2, and angle3.
self you already know about.
angle3 are arbitrary variables but by their names we can assume they are going to be three distinct numbers. The body of the constructor method (
__init__) performs setting properties on the class itself (remember
self refers to the current object).
check_angles method takes only one method argument (
self!) which you know about. Its body simply performs a quick check to see if the sum of all the angles equals 180 which is a geometry concept that defines a triangle. If so, you return
Hopefully this helped you!
Extra reading: Why explicit
self has to stay