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 trialCaleb Newell
12,562 Pointsmaking 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
class Student:
name = 'Caleb'
2 Answers
William Li
7,950 PointsYou 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)
ERDAL DINCER
1,635 Points''' class Student:
name= 'Erdal'
Student.name=me
print(me)
I have been trying and been failing ,, can anyone help me ? '''
Caleb Newell
12,562 Pointsyou'll need to add something like this:
class Student:
name = 'Your_name'
me = Student()
print(me.name)
Tristan Rodgers
8,137 PointsTristan Rodgers
8,137 PointsI'm having trouble with the code, I've entered the exact thing and it could not find 'student'