Help - Trying to Understand Why This Error


#1


6 - Referring to a member variables

The following error is generated when I save and submit: AttributeError: 'function' object has no attribute 'model'

Expect no error


class Car(object):
    condition = "new"

def __init__(self, model, color, mpg):
    model = model
    self.color = color
    self.mpg = mpg
    
def my_car():
    self = "Delorean"
    color = "silver"
    mpg = 88
    
print my_car.model


#2

    self.model = model

This can be removed. To instantiate a my_car object, use a function call:

my_car = Car("Delorean", "silver", 88)