Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.

2. Searching for something specific? See our text overview of all tests. Scroll right for levels, and lists.

3. Student and Teacher User Guides |  Schemes of Work |   Real Teacher use Videos |

Join 36000+ teachers and students using TTIO.

Classes and Objects

Python is an object oriented programming language. Almost everything in Python is an object, with its attributes/properties and methods. A Class is like an object constructor, or a "blueprint" for creating objects.

To create a class, use the keyword class:

Example: Create a class named MyClass, with a property named x:

class MyClass:
  x = 5

Try it Yourself »

Now we can use the class named MyClass to create objects:

Example: Create an object named p1, and print the value of x:

p1 = MyClass()

Try it Yourself »

Classes and Objects - Learning Video

PowerPoint (for the above video)

Additional Reading