Tried the following code:
class Car(object): condition = "new" my_car = Car() def __init__(self, model, color, mpg): self.model = model self.color = color self.mpg = mpg my_car = Car("DeLorean", "silver", 88) print my_car.condition print my_car.model print my_car.color print my_car.mpg
And got this error message:
Traceback (most recent call last):
File "python", line 1, in
File "python", line 4, in Car
NameError: name 'Car' is not defined
Oops, try again. You need to pass three arguments when creating a Car().
What am I doing wrong? If I pass model, color, mpg into the Car() object on line 4 btw, I still get an error saying Oops, try again. It looks like you haven't created a Car object named my_car.