The first part of my code works and it is able to print condition, color, model and mpg without issue however when I try to make use of display_car I get the following error message.
Traceback (most recent call last):
File "python", line 15, in
AttributeError: 'Car' object has no attribute 'display_car'
My code should print "This is a silver DeLorean with 88 MPG." Thank you for your time and assistance.
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,self.mpg) my_car = Car("DeLorean", "silver", 88) print my_car.condition print my_car.model print my_car.color print my_car.mpg print my_car.display_car