Replace this line with your code.
condition = "new"
def init(self, model, color, mpg):
self.model = model
self.color = color
self.mpg = mpg
def display_car(self): #dis = "This is a "+self.color+" "+self.model+" with"+ " "+str(self.mpg)+" MPG" return "This is a %s %s with %s MPG" %(self.color, self.model, str(self.mpg))
my_car = Car("DeLorean", "silver", 88)
this is my console output:
This is a silver DeLorean with 88 MPG
but error keeps showing as below:
Oops, try again. It looks like you didn't print "This is a silver DeLorean with 88 MPG.".
what is wrong with my code?
below is the instruction:
- Inside the Car class, add a method named display_car() to Car that will reference the Car's member variables to return the string, "This is a [color] [model] with [mpg] MPG." You can use the str() function to turn your mpg into a string when creating the display string.
- Replace the individual print statements with a single print command that displays the result of calling my_car.display_car()
Do you agree with that error message?
If yes, consider what could have this effect.
If no, compare more carefully to what your code does. There's no "almost" right here.
Just put a full stop after MPG in your return code ....