This can't be happening!


#1



I don't know how or why I am stuck here but please help me! This is the error:
You haven't created a Car object named my_car; make sure you create my_car after defining Car.


class Car(object):
    my_car = Car()


#2

you first need to create the class, and then after the class create the instance

remember: classes can't be empty/have no content. Look in the instructions for what you should put as class content


#3

These are the instructions: Instructions
Below your Car class, create a new object named my_car that is an instance of Car.


#4

but you created the instance inside the class, not below/after, which is not what you should do.

classes are like blueprints, then the instances are the things build from the blue print

so for example before a house is build, a blueprint is created (class) and then after the blueprint is finished, they start building the actual house (class instance)

what you did, is like trying to build a house while still working on the blueprint.


#5

And how can I finish the blueprints first?


#6

finish the class, before creating an instance.

In python, what determines if something is nested inside a class?


#7

How the code should look, because I have no clue what's is going on!


#8

i guess i would just have to answer my own question

indent determines what is nested inside or outside a class (just like loop, functions and so on), so if we want to create the instance outside the class, how much indent should it have?


#9

class Car(object):

my_car = Car()


#10

very good, but you forgot a piece of information i already gave you:


#11

AAAAAAAAAAAAAAAAAAAAAAAAAA :@ :@... Anyway now I got it! Thank you so much for the explanation! Instances are outside the class, gotta remember it!


#12

you're welcome

Yep, just think about the blueprint, you don't start building a house before you finished a blueprint


#13

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