8/11 Help


#1

Here's my code:
class Car(object):
condition = "new"
def init(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
def display_car(self):
return 'This is a %s %s with %s MPG.' % (self.color, self.model, str(self.mpg))
def drive_car(self):
self.condition="used"
my_car = Car("DeLorean", "silver", 88)
print my_car.condition
drive_car()
print my_car.condition

I can't seem to figure out what I'm doing wrong.


#2

this line

drive_car()

should be

my_car.drive_car()

remember the drive_car() function is for the Car class so to invoke you must use an instance of the class in this case my_car


#3

Thanks. I was losing my mind on that one.