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 trial

Python Object-Oriented Python Instant Objects Your first class

Prem Yadav
Prem Yadav
7,346 Points

Not able to solve this problem.....

Hi there In this problem i'm understanding where is my mistake please help as soon as possible.....

first_class.py
class Student:
    name = "PreM"

from characters import Student
    me = Student()
    me.name

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're doing fairly well, but there's no need to import anything. Also it asks you to print the name of the new student you made. You've typed me.name but that doesn't do anything by itself. It either needs to be assigned to a variable or displayed in some way. I've altered your code slightly and included comments. Take a look:

class Student:  #create a new class named Student
    name = "PreM"  #set the name property to your name

me = Student()  #create a new instance of Student and assign it to a variable
print(me.name)  #print the student's name

Hope this helps! :sparkles: