Reffering to Memeber Variable>>>STILL HELP


#1

class Car(object):
    condition = "new"
    def __init__(self, model, color, mpg):
        self.model = "DeLorean"
        self.color = "silver"
        self.mpg = 88
my_car = Car(model, color, mpg)
print my_car.condition

print my_car.model
print my_car.color
print my_car.mpg

I did it myself, it didn't work. Then, I checked hint and saw that I did it as they wanted. It's still not working. What could be wrong?
IGNORE THE INIT, IT HAS THE UNDERSCORES. The forum just prints it out as it is.


#2

Your car's condition should be inside your function,

def __init__(self, model, color, mpg):
    self.model = model
    self.color =  color
    self.mpg = mpg
condition = "new"

#3

I already got it, the condition is fine where it is. I just have to change (my_car = Car(model, color, mpg)) to (my_car = Car("DeLorean", "silver", 88))


#4

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