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 trialFrances Angulo
5,311 PointsStudent class
This code runs in the workspace but just doesn’t work here, what am I missing??
class Student:
name = "Frances"
me = Student()
print(Student.name)
2 Answers
Steven Parker
231,268 PointsYou've created an instance named "me" but the "print" is attempting to access the class "Student" directly. The name
attribute of your instance would be "me.name
".
Also, the "print" statement should not be indented.
Frances Angulo
5,311 PointsAh - I wish the errors were more expressive or we had some sort of output that demonstrated why I was getting the right result but via the wrong class method. woof.
Steven Parker
231,268 PointsActually, if you had only the first issue, the error message given would have been much more helpful:
Bummer: Be sure to use me.name
to print the attribute!