the title is just an example, but my point is why is this nessasary? "wheels" isnt used anywhere so why is this so nessasary? here is where i got the code from:
class Car(object): def __init__(self, wheels, miles, make, model, year, sold_on): """Return a new Car object.""" self.wheels = wheels self.miles = miles self.make = make self.model = model self.year = year self.sold_on = sold_on def sale_price(self): """Return the sale price for this car as a float amount.""" if self.sold_on is not None: return 0.0 # Already sold return 5000.0 * self.wheels
what i want to highlight is the sale_price function and it's last line, if we set self.wheels to be wheels, why cant we use wheels then instead. And if this cannot be done, why bother setting self.wheels to anything anyway.