Member variables


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 {color} {model} with {mpg} MPG.'.format(
    def drive_car(self):
        self.condition = "used"
my_car = Car("DeLorean", "silver", 88)
print my_car.condition
print my_car.model
print my_car.color
print my_car.mpg
print my_car.condition
print my_car.drive_car()
print my_car.condition()

ERROR MESSAGE::Traceback (most recent call last):
File "python", line 21, in
TypeError: 'str' object is not callable




print my_car.condition()

my_car.condition is a string, adding parentheses means python will attempt to call the string like a function call, which results in an error (string not callable)

you didn't have the parentheses before:

my_car = Car("DeLorean", "silver", 88)
print my_car.condition # no parentheses

not sure why you added them later


oh!! I forget to remove these braces..btw thanks