Get startedGet started for free

Exploring object interface

The best way to learn how to write object-oriented code is to study the design of existing classes. You've already learned about exploration tools like type() and dir().

Another important function is help(): calling help(x) in the console will show the documentation for the object or class x.

Most real world classes have many methods and attributes, and it is easy to get lost, so in this exercise, you will start with something simpler. We have defined a class, and created an object of that class called mystery. Explore the object in the console using the tools that you learned.

This exercise is part of the course

Object-Oriented Programming in Python

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise