What is wrong with my code?


#1

https://www.codecademy.com/courses/python-intermediate-en-egNXj/1/1?curriculum_id=4f89dab3d788890003000096#

The error message says “Oops, try again. It looks like you didn’t print “This is a silver DeLorean with 88 MPG.”.”

But it actually did print the same “This is a silver DeLorean with 88 MPG
None” in the console.
What to do? Please help!

```python
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))

my_car = Car("DeLorean", "silver", 88)
my_car.display_car()

#2

You forgot to add a period ( . ) after MPG in your string. Codecademy is very strict on spelling. They want it to look just like theirs.


#3

Oh my goodness!! Thank you!


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.