10. Overiding Methods


#1


https://www.codecademy.com/en/courses/python-intermediate-en-egNXj/1/4?curriculum_id=4f89dab3d788890003000096


Am getting the error "Oops, try again. It looks like you didn't update the condition of my_car to 'like new'."

I've gone through all of the forum and really don't see the issue if anyone can please help.


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, str(self.mpg))
        
    def drive_car(self):
        self.condition = "used"

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

my_car.drive_car()

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", "gold", 100, "molten salt")

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


#2

The error is pointing to this.

You didn't use the print keyword to print like new.

Hope this helps! :slight_smile:


#3

you're problem is in the "self_condition" line.


#4

An underscore instead of a "."

Thanks!


#6