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

Stacey Normington
Stacey Normington
4,892 Points

object oriented challenge part 2

I don't understand what I'm doing wrong I followed the instructions to write student and its throwing a name error saying student isn't recognised can anyone help.

first_class.py
class Student:
    name = "Stacey"
me = Student()
print(name)

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 67,665 Points

Hey Stacey Normington , you’re on the right path.

The defined instance of Student is me. To access the attribute name of me, use the “dot notation” me.name

Post back if you need more help. Good luck!!!

Stacey Normington
Stacey Normington
4,892 Points

I tried that out and it comes back saying couldn't find student is there something I'm missing when writing the class

Chris Freeman
Chris Freeman
Treehouse Moderator 67,665 Points

If it says, "cannot find Student", this implies a syntax error that prevents the checker from continuing leaving Student undefined.

The only thing that needs to change is the argument in the print statement: name :point_right: me.name.

Try again, you'll get this. Of course, post back if you need more help. Always happy to help! Good luck!!