Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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: