Referring to member variables


#1




Oops, try again. my_car needs model, color and mpg member variables.


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

my_car = Car("DeLorean", "silver", 88)
print my_car.condition
print my_car.model
print my_car.color
print my_car.mpg


#2

I think a comma is missing there, isn't it? :confused:


#3

You're right, can't believe I missed that– thank you!


#4

Sure thing! It happens to the best lol ^^


#5

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