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 trialScott Rivers
1,400 Pointssays create a variable named me and assign to an instance named student, what am i doing wrong
class Student: name = "scott" me = Student()
print(name)
class Student:
name = "scott"
student() = me
print(name)
1 Answer
Rick Gleitz
47,840 PointsHi, Scott, The variable and print statements need to be outside the class, so don't indent them. And remember that when we declare a variable, whatever is on the right is what is stored in the variable, which is on the left (in other words, you reversed the variable statement). Also, to get the print statement to work, it needs to be me.name so it can access the student instance, which will access the class. Hope this helps!
Curtis Nouchi
Python Development Techdegree Student 2,463 PointsCurtis Nouchi
Python Development Techdegree Student 2,463 PointsHi Scott!
name is the variable you want to print, so based on the info here, you don't need the student() = me, or the class Student code. Hope that helps or answers!