7/11 need help


I can't figure out what the heck is wrong, Ive checked the internet on help but nothing is working.

Heres my 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 %s %s with %s MPG." % (self.color, self.model, str(self.mpg))

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

And this is the error code:

Oops, try again. Make sure you built the display string correctly, adding member variables together with text using +'s.

This is what it says in the window:

File "python", line 12
print my_car.display_car()
SyntaxError: invalid syntax


Make sure that your post accurately represents your code so that we're actually looking at the code you're having trouble with.


I got this dude. The trouble is that you're trying to convert mpg, which in this case is recognized as float or decimal, from its initial type to string inside the return statement.

return "This is a %s %s with %d MPG." % (self.color, self.model, self.mpg)

If you want it to be a float, then use %f. Everything else works. It passed for me, so it should work for you too.