Modifying member variables


#1



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
my_car.dirve_car()
print my_car.condition


#2

You misspelled drive here:

EDIT:
Also here:

should be driving.

EDIT 2:
Found another one


#3

Thank you so much :slight_smile:


#4

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