In this series, we’ll explore Object Oriented Programming. Everything is an object in Python.

Sometimes the terms objects and classes are mixed, but they are different concepts. An object can hold variables and methods. A class is a blue print that objects are created from.

Related course: Python Programming Courses & Exercises


An object can contain variables and/or methods that interact with those variables. Sometimes objects are named after real world objects.

In a RC car program, you may find:

servoMotor = Motor()
The first line creates the object. The second line calls the method turnOn(). That method may modify the objects variables.

Objects are not always named after real world objects. In the context of the program, it could even have a one letter name. Consider:

r = Robot()

You may often find other non real-world names. It’s common that applications have some objects that make sense only to coders, like HTTPFetcher or HTMLParser.


An object doesn’t appear out of the blue. It’s created with help of a class. A class is a grouping of methods and variables, sort of an abstract model.

python class

Objects are always created using classes. A class defines an objects methods and variables, but it doesn’t hold the actual variable data.

class Robot:
name = ""

Objects can be created a runtime - when the program is running. Classes are always defined in the code, before the program starts.

r2d2 = Robot()
bb8 = Robot()

If you are a Python beginner, then I highly recommend this book.

Download exercises