Python Object-Oriented Python Instant Objects Your first class

Gabriel Alcaraz
Gabriel Alcaraz
2,550 Points

Am I doing something wrong?

I am on the second part of this challenge and I do not understand the instance part of it I am on the YOUR FIRST CLASS assignment

first_class.py
class Student:
    name = 'gabriel'
    me = Student()
    me.name
    print(name)

1 Answer

Brandon White
seal-mask
MOD
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Treehouse Moderator

Hi Gabriel,

You’re off to a good start, but right now you have all of your code nested within the class definition.

You’ll want to move the statement where you create an instance of your class to outside of the class definition. You’ll need to outdent(?)/or un-indent.

Then you’ll call the me.name like you’re already doing on line four, you’ll just want to pass that as an argument into the print function.

You’re currently passing the variable name (which is undefined outside of the class/class instance) into the print function, and that will result in an error.

Gabriel Alcaraz
Gabriel Alcaraz
2,550 Points

thank you so much its out dent by the way