I am learning python right now and I am learning about classes. I am confused about the purpose of self and more specifically why I have to write self.make = make, etc.
Here is my example:
class Car():
def _init_(self, make, model, year):
self.make = make
self.model = model
self.year = year
def get_name(self):
long_name = str(self.year) + ' ' + self.make + ' ' + self.model
return long_name.title()
To me, this looks like you are just setting a variable to itself which doesn't make sense to me. What is the purpose of this statement?