Creating Class Methods


#1

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,self.mpg)

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

this is my code and it prints the required stuff but still it the console gives the error " Oops, try again. It looks like you didn't print "This is a silver DeLorean with 88 MPG."."
even though my code prints the above statement


#2

Hi @abhishek998,

Your output needs to match exactly the format of the output specified in the instructions, including punctuation.


#3