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

making an instance of a class

this is challenge 2 of 2, and it says:

Great work! Now, make an instance of your class named me. Then print() out the name attribute of your instance.

I do not really understand this, anything helps. thanks

first_class.py
class Student:
    name = 'Caleb'

2 Answers

You will need to create an instance of the class and assign it to a variable named 'me' The using the variable 'me' get the value of the variable/attribute 'name' and print it out.

Here's how I would do it

me = Student()
print(me.name)

I'm having trouble with the code, I've entered the exact thing and it could not find 'student'

''' class Student:

name= 'Erdal'

Student.name=me

print(me)

I have been trying and been failing ,, can anyone help me ? '''

you'll need to add something like this:

class Student:
    name = 'Your_name'

me = Student()
print(me.name)