Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Object-Oriented Python Instant Objects Your first class

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.

thank you so much its out dent by the way