← Python

OOP – Classes & Objects

A class is a blueprint that defines structure and behaviour; an object is one instance created from that blueprint

What it does: A class is a blueprint that defines the structure of a group of objects — what data they hold and what they can do. An object (also called an instance) is a specific thing created from that class, using the class's name like a function: Dog('Rex'). Inside a class's methods, self refers to the particular object the method is being called on, which is how each object keeps its own separate data.

Common mistakes: class must be written lowercase — Class Dog: is invalid Python, even though it looks like a small typo. Forgetting self as the first parameter of a method is another common early mistake, since Python doesn't add it automatically.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
What is a class?
A blueprint for creating objectsA function
Matches
❌ class dog: pass
Error: Class names should be CapWords
Applying
Meanings
Term
Class
Meaning
A blueprint that defines the structure of objects.
Practice
class Dog:
Testing
Gaps
Dog:
Check Answer
Spots
1Class Dog:
2 def __init__(self, name):

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Gila Monster' badge — Patient Coder, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. What is a class?
A. A blueprint for creating objects ✓
B. A function
A class defines structure and behaviour — each object built from it follows that blueprint
2. What is an object?
A. A class definition
B. An instance created from a class ✓
The class is the template; an object is one specific thing made from it
3. How do you create an object?
A. my_obj = ClassName() ✓
B. def ClassName():
Call the class like a function — it returns a new instance
4. What does 'self' refer to?
A. The class itself
B. The current object instance ✓
self is how a method refers to the specific object it was called on
5. class Dog:\n pass\ndog = Dog()\nWhat is dog?
A. An instance of the Dog class ✓
B. The Dog class
Dog() creates an instance — dog is the object, Dog is the class

Match the Pairs

class dog: pass Error: Class names should be CapWords
class Dog pass Error: Missing colon after class name
class Dog: pass d = Dog() Valid: Class defined and instance created
class Car: pass a = Car() b = Car() Ok: Two separate objects
class Dog: pass d = Dog() print(type(d)) Output: <class '__main__.Dog'>
class Cat: pass c = Cat() c.name = 'Mia' print(c.name) Output: Mia

Key Term

Class
A blueprint that defines the structure of objects.~~Object

Fill in the Blanks

1. class Dog: pass
2. class Dog: pass my_dog = Dog()
3. p = Person() p.name = 'Alice'
4. class Car: pass
5. print(type(my_dog))

Spot the Error

Question 1
A Class Dog:
B def __init__(self, name):
C self.name = name
D def bark(self):
E return 'Woof!'
Line A — class must be lowercase: Class is not valid Python
Question 2
A class dog:
B def __init__(self, name):
C self.name = name
D def bark(self):
E return 'Woof!'
Line A — Class names should use CamelCase: Dog not dog
Question 3
A class Dog
B def __init__(self, name):
C self.name = name
D def bark(self):
E return 'Woof!'
Line A — Missing colon after the class name
Question 4
A class Dog():
B pass
C
D my_dog = Dog
Line D — Missing parentheses: Dog() creates an object, Dog is the class itself
Question 5
A def Dog:
B def __init__(self, name):
C self.name = name
D def bark(self):
E return 'Woof!'
Line A — Use class to define a class, not def (def is for functions)
For Teachers

Create a free class, add this module to a journey, and track who's stuck.

Create a free teacher account →

No credit card. No setup fee. Make a class and invite students in under three minutes.

For Students

Practice this topic interactively, track progress, and unlock badges.

Start Learning Free →

Have a class code?