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 trialMikkel Bielefeldt
3,227 Pointsfirst_class.py
I'm just lost here I've tried a little bit of everything, and rewatched Kenneth's video multiple times, but just cant seem to figure it out. I should probably add that quiz or test number one wasn't a problem it's number two where I just fall apart.
class Student:
name = "Mikkel Bielefeldt"
2 Answers
KRIS NIKOLAISEN
54,971 PointsYou could check the Python docs. There you will find:
Class instantiation uses function notation. Just pretend that the class object is a parameterless function that returns a new instance of the class. For example (assuming the above class):
x = MyClass()
KRIS NIKOLAISEN
54,971 PointsThe second task is to create an instance of your class named me. Following the syntax above:
me = Student()
Then print the name attribute of the instance.
print(me.name)
This should print "Mikkel Bielefeldt"
Mikkel Bielefeldt
3,227 PointsMikkel Bielefeldt
3,227 PointsHi Kris Nikolaisen. Iβve been sitting at this problem for quite awhile and I just donβt get it can you go in more depth or just give me the answer and then Iβll review it and try my own things.