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): print self.model condition = "used" self.condition = 'used' my_car = Car("DeLorean", "silver", 88) print my_car.condition my_car.drive_car print my_car.condition it gives an error ""Oops, try again. You didn't display the 'used' condition of the car after drive_car(). "" can anybody help me
def drive_car(self): print self.model condition = "used" self.condition = 'used'
You don't need first two lines inside of function/method drive_car(self)
when i put the (print self.model) outside of the method, it gives an erros .it says "self" is not defined
Delete that part and try to run the code.
do reply what you get?
i did what you said , it works thank you
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.