10. Overriding methods


#1

Hi Guys,
Need your help
Check my code many times. Tried to find the answer, many people faced with the same problem. I get "Oops, try again. It looks like you didn't update the condition of my_car to 'like new'."

I console output I got
"new"
"like new" but the program send me error message

<


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 %s %s with %s MPG." % (self.color, self.model, str(self.mpg))
    def drive_car(self):
        self.condition = "used"

#my_car = Car("DeLorean", "silver", 88)



class ElectricCar(Car):
    def __init__(self, model, color, mpg, battery_type):
        self.battery_type = battery_type
        self.model = model
        self.color = color
        self.mpg   = mpg
    def drive_car(self):
        self.condition = "like_new"


my_car = ElectricCar("Tesla", "White", 33, "molten salt")

print my_car.condition
my_car.drive_car()
print my_car.condition.>


#2

like new should have a space between the words, not a underscore?


#3

Oooo stetim94 thank you very much! It was just spelling not coding error. I spend more than 1 hour in debugging before decided to write here =)))


#4

Issue resolved? Yep, it was just a spelling error, codecademy is sometimes strict in spelling


#5

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