Modifying member variables gives an odd error


I am using the following 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 " + self.color + " " + self.model + " with " + str(self.mpg) + " MPG."
def drive_car(self):
    self.condition = "used"

my_car = Car("DeLorean", "silver", 88)
print my_car.condition

I get the following output:


Which is correct, but I get the following error at the bottom:

Oops, try again. You don't need to display_car().



As indentation is VERY important in Python,
could you please re-edit your Original Post
so we can see, if you used the indentation properly.....

Please re-edit your Post

  • leave one blank-line above of your code
  • select your code in the Post
  • then =click= on the </>-symbol-of-this-editor

Your code will then be in a pre-code state
and you will be able to make/present the proper indentations.

or even better use


Thanks for the reply. I don't know what happened, but I went out of codecademy, then came back in and it worked.

print my_car.condition
print my_car.condition