6/11 Referring to Member Variables


#1



https://www.codecademy.com/courses/python-intermediate-en-egNXj/0/6?curriculum_id=4f89dab3d788890003000096#


Here is the error message:

Traceback (most recent call last):
File "python", line 8, in
TypeError: object.new() takes no parameters

This message comes up too:

Make sure you pass the self keyword to the init() function.


`python

My code:

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

Hi thsi line

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

the model of the car should be "DeLorean". instead of "Delorean" with the uppercase L


#3

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