2. create an instance of a class


#1



hello... i think i got i careless error here... but im unable to see anything wrong...

pls help thx :smile:


Oops, try again. You haven't created a Car object named my_car; make sure you create my_car after defining Car.


class Car(object):
    pass
my_car = Car(object)


#2

needs to be

my_car = new Car(object)

#3
class Car(object):
    pass
my_car = new Car(object)

codecademy says this...Oops, try again. You haven't created a Car object named my_car; make sure you create my_car after defining Car.

console... File "python", line 3
my_car = new Car(object)
^
SyntaxError: invalid syntax


#4

OH, I'm stupid, sorry. You only need

my_car = Car()

on line three


#5

Since this is Python, omit new. Also, as of this exercise, we should not pass an argument when creating an instance of Car. That will come later.

So, for now, we can do this ...

my_car = Car()

#6

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