# Author: james tam # Version: Dec. 3, 2023 # Learning: why the 'self' parameter is necessary/how it works. class Car: def __init__(self,make,model): #Self helps disambiguate names self.make = make self.model = model #The self parameter distinguishes the object whose method is called vs. #other objects of that class. def equals(self,comparisonCar): equal = True if((self.make != comparisonCar.make) or \ (self.model != comparisonCar.model)): equal = False return(equal) def start(): car1 = Car("Eagle","Talon") car2 = Car("Eagle","Vista") if (car1.equals(car2)==True): print("Same type of car") else: print("Different type of car") print() car2 = Car("Eagle","Talon") if (car1.equals(car2)==True): print("Same type of car") else: print("Different type of car") start()