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!

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

Cannot create instance of a class without console. No console is given.

I'm trying to complete the first exercise. It requires I create an instance of the Student class called me.

I've only been taught how to do this using console, but nothing is visible. Could this be a bug?

class Student:
    name = 'Jacob'

me = Student()


1 Answer

Ryan S
Ryan S
27,276 Points

Hi Jacob,

No its not a bug, you can instantiate an object inside a file just like you would call a function after defining it. But you are probably correct to perceive it as bit strange because often you would define your classes in their own .py file, and instantiate them in another, or in the terminal, or as a model instance in a database.

But you pretty much solved this challenge, the only thing is that you forgot to print the last line.