Initializing a class in Lesson Classes


#1

I followed both instructions but on both exercises I keep getting that error message
I dont see anything wrong ...can someone please help .


#2

This is because on line 3 you have already created the my_car instance of car. If you delete line 3 and 4 you should be fine.

Also, you must place your init function inside your Car class. so tab it over and take out some white space :slightly_smiling: .

Hope this helps :sunny:


#3

thanks man but im getting an error on the next excercise as well similar one can you tell me whats wrong here ?


#4

Your code should look like this..

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)  
`Your print statements here`

#5

i just got it
thanks all the same bro