2.creating instance of a class


#1

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

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


#2

currently, your Car object my_car is part of Car. Place my after/outside after defining Car.

Hint: python relies on indention to determine what is inside a class.


#3

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