class Car(object): condition = "new" def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg def display_car(self): print "This is a %s %s with %s MPG." % (self.color, self.model, str(self.mpg)) def drive_car(self): self.condition = "used"
Why are we initially able to declare the member variable
condition = without using the dot notation (line 2) but once we decide to define a method that changes the variable’s value we must use the dot notation, as such
self.condition = (line 12, last line)?