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 trialTinotenda Emmanuel Nyamukapa
5,127 PointsHow to create instance in class
I am stuck on how to make an instance in a class. Please help
class Student:
name = 'Tino'
new_instance = Student()
new_instance.name_method()
1 Answer
Steven Parker
231,248 PointsYour instance has the wrong name. The instructions said to "make an instance of your class named me." But this instance is named "new_instance" instead. Also, the code outside the function should not be indented.
Then, the other part of the task is to "print() out the name attribute of your instance." So you'll need a "print" statement that accesses the "name" attribute of the instance. There won't be any method to call.