Creating clas methods


#1



So it was printed in the console, but codeacademy says it hasn't been printed (?)


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()


#2

"." was missing in the end of the string.


#3

you miss a full stop after MPG


#4

you haven't put a str() on the mpg so it goes like self.str(mpg)


#5

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