← Python

OOP – Methods

A method is a function defined inside a class that operates on the object's data via self

What it does: self refers to the object the method is called on. self.name reads the name attribute of the current object. Methods are functions that belong to a class and operate on its objects. Python uses self — other languages use this, but Python convention is self. Methods are functions — they can return any value using return. The method explicitly returns 'Woof!' — so that's what the call evaluates to. Classes can have any number of methods — __init__ is just one of them. A method is just a function defined inside a class — it gets self automatically.

Common mistakes: Missing self parameter every method needs self as first parameter. Use self.name inside methods name alone is not defined here.

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 method?
A function defined inside a classA standalone function
Matches
❌ def bark():
Error: Missing self parameter
Applying
Meanings
Term
Method
Meaning
A function defined inside a class.
Practice
class Dog:
Testing
Gaps
def bark():
Check Answer
Spots
1class Dog:
2 def bark():

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

The 'Puffin' badge — Definition Diver, 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 method?
A. A function defined inside a class ✓
B. A standalone function
Methods are functions that belong to a class and operate on its objects
2. What must be the first parameter of a method?
A. this
B. self ✓
Python uses self — other languages use this, but Python convention is self
3. dog.bark() do you pass self?
A. No Python passes it automatically ✓
B. Yes
Python inserts self automatically — you only pass the other arguments
4. Can methods access self.name?
A. No
B. Yes that's how they use object data ✓
self gives the method a reference to the object, so it can read all its attributes
5. Can methods return values?
A. Yes just like regular functions ✓
B. No methods can't return
Methods are functions — they can return any value using return

Match the Pairs

def bark(): Error: Missing self parameter
dog.Bark() Error: Method names are case-sensitive
def bark(self): Valid: Method with required self
self.name Ok: Access instance attribute in a method
'hello'.upper() Output: HELLO
[1,2,2].count(2) Output: 2

Key Term

Method
A function defined inside a class.~~self

Fill in the Blanks

1. class Dog: def bark(self): return 'Woof!'
2. class Dog: def bark(self): return self.name + ' says Woof!'
3. dog = Dog('Rex') print(dog.bark( ))
4. class Counter: def __init__(self): self.count = 0 def increment(self): self.count += 1
5. class Circle: def area(self): return 3.14 * self.radius ** 2

Spot the Error

Question 1
A class Dog:
B def bark():
C return 'Woof!'
Line B — Missing self parameter every method needs self as first parameter
Question 2
A class Dog:
B def __init__(self, name):
C self.name = name
D def bark(self):
E return name + ' says Woof!'
Line E — Use self.name inside methods name alone is not defined here
Question 3
A dog = Dog('Rex')
B dog.bark
Line B — Missing parentheses bark is a method, call it with ()
Question 4
A class Dog:
B def bark(self):
C return 'Woof!'
D
E Dog.bark()
Line E — Call methods on objects, not the class. Create an object first.
Question 5
A class Dog:
B def bark(self):
C return 'Woof!'
D
E dog = Dog()
F print(dog.bark(self))
Line F — Don't pass self when calling Python fills it in automatically
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?