Python Object-Oriented Python Instant Objects Your first class

Tinotenda Emmanuel Nyamukapa
Tinotenda Emmanuel Nyamukapa
5,127 Points

How to create instance in class

I am stuck on how to make an instance in a class. Please help
class Student:
    name = 'Tino'

    new_instance = Student()

1 Answer

Steven Parker
Steven Parker
203,989 Points

Your instance has the wrong name. The instructions said to "make an instance of your class named me." But this instance is named "new_instance" instead. Also, the code outside the function should not be indented.

Then, the other part of the task is to "print() out the name attribute of your instance." So you'll need a "print" statement that accesses the "name" attribute of the instance. There won't be any method to call.