#sample solution
class Car(object):
condition = "new"
def __init__(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
def displayCar(self):
return "This is a %s %s with %s MPG." % (self.color,self.model,self.mpg)
def driveCar(self):
self.condition = "used"
myCar = Car("DeLorean", "silver", 88)
print myCar.condition
myCar.driveCar()
print myCar.condition
No comments:
Post a Comment