class Car():
def __init__(self,color,model):
self.color=color
self.model=model
Audi = Car("red","A4")
print(Audi.color())
print(Audi.model())
I'm getting a "string object is not callable" error. What am I doing wrong?
class Car():
def __init__(self,color,model):
self.color=color
self.model=model
Audi = Car("red","A4")
print(Audi.color())
print(Audi.model())
I'm getting a "string object is not callable" error. What am I doing wrong?
Remove the parentheses:
print(Audi.color)
print(Audi.model)
since model
and color
are simple string attributes of Car
rather than callable methods.