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 trialRoniel Flores
821 PointsI dont know the next step of this ... should I had seen in the video
how do I make an instance of me?
class Student:
name = "Roniel FLores"
me = print(Roniel FLores)
2 Answers
Christian Mangeng
15,970 PointsHi Roniel,
this is how you create the instance:
me = Student()
It creates an instance of Student that is called "me". Note that the instance needs to be created OUTSIDE the Student class definition (so it's not indented). The instance takes no arguments for its initialization, that's why the parentheses are empty. Now you can access the name property of the Student instance (which is called: me) with me.name
Roniel Flores
821 Pointsso put a pass and then me = student() ?
Christian Mangeng
15,970 PointsA class is not a function, so it does not require a pass. It is complete like this:
class Student:
name = "Roniel FLores"
Now you can create the instance (below the class, but not inside of it) and then print me.name. This prints what is stored in the name variable of the class.
Roniel Flores
821 Pointsit does not work, I try multiple ways
Roniel Flores
821 Pointsthank you, it worked
Roniel Flores
821 PointsRoniel Flores
821 PointsI tried it, doesnt work, please help, I am stuck here lol and cant move forward.
thank you,
Roniel