Classes Exercise 7 Possible bug


#1




Code outputs "This is a silver DeLorean with 88 MPG." The exercise gives the error message "Oops, try again. It looks like you didn't print "This is a silver DeLorean with 88 MPG."." Both strings are exactly the same. Does the software not like the use of commas in print statements?


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

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


#2

You need to concatenate.


#3

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