Modifying member variables


Modifying member variables

it says Make sure that your car class has a drive_car() method.

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"
    def dirve_car(self):
        print "You are diving a " + self.model + "!"
        self.condition = "used"
my_car = Car("DeLorean", "silver", 88)
print my_car.condition
print my_car.condition


You misspelled drive here:

Also here:

should be driving.

Found another one


Thank you so much :slight_smile:


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