Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python Instant Objects Your first class

Stacey Normington
Stacey Normington
5,861 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 68,425 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
5,861 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 68,425 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!!