← Python

String Methods (upper, lower, replace…)

String methods are called with dot notation on a string and return a new modified string

What it does: .strip() removes leading and trailing whitespace from the string. .split(',') splits the string at each comma into a list. upper() converts every character to uppercase. replace() swaps every occurrence of the first arg with the second. Strings are immutable — methods return a new modified string. 'hello' starts with 'he' — that's True. h-e-l-l-o contains two 'l' characters. 'll' starts at index 2: h(0) e(1) l(2)l(3).

Common mistakes: upper() returns a new string: must assign it back or print directly. Method names are lowercase: upper(), not Upper().

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 does 'hello'.upper() return?
'HELLO''Hello'
Matches
❌ name = 'hello' name.Upper()
Error: Method names are lowercase
Applying
Meanings
Term
.upper()
Meaning
Returns the string in all uppercase letters.
Practice
name = 'hello'
Testing
Gaps
print(name.())
Check Answer
Spots
1name = 'hello'
2name.upper()

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

The 'Sea Dragon' badge — OOP Pioneer, 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 does 'hello'.upper() return?
A. 'HELLO' ✓
B. 'Hello'
upper() converts every character to uppercase
2. What does 'HELLO'.lower() return?
A. 'Hello'
B. 'hello' ✓
lower() converts every character to lowercase
3. What does 'abc'.replace('b', 'x') return?
A. 'axc' ✓
B. 'abc'
replace() swaps every occurrence of the first arg with the second
4. Do string methods change the original string?
A. Yes
B. No they return a new string ✓
Strings are immutable — methods return a new modified string
5. What does ' hi '.strip() return?
A. 'hi' ✓
B. ' hi '
strip() removes whitespace (spaces, tabs, newlines) from both ends

Match the Pairs

name = 'hello' name.Upper() Error: Method names are lowercase
'hello'.replace('l') Error: replace() needs 2 arguments
' hi '.strip() Valid: Returns 'hi'
'a,b,c'.split(',') Ok: Returns ['a','b','c']
print('hello'.upper()) Output: HELLO
print('hi'.replace('h','H')) Output: Hi

Key Term

.upper()
Returns the string in all uppercase letters.~~.lower()

Fill in the Blanks

1. name = 'hello' print(name.upper())
2. name = 'HELLO' print(name.lower())
3. msg = 'I like cats' print(msg.replace('cats', 'dogs'))
4. text = ' hi ' print(text.strip())
5. csv = 'a,b,c' print(csv.split(','))

Spot the Error

Question 1
A name = 'hello'
B name.upper()
C print(name)
D print('Done')
Line B — upper() returns a new string: must assign it back or print directly
Question 2
A name = 'hello'
B result = name.Upper()
C print('Result:', result)
D print('Done')
Line B — Method names are lowercase: upper(), not Upper()
Question 3
A name = 'hello'
B result = upper(name)
C print('Result:', result)
D print('Done')
Line B — upper() is a string method: use name.upper(), not upper(name)
Question 4
A msg = 'hello'
B result = msg.replace('l')
C print('Result:', result)
D print('Done')
Line B — replace() needs two arguments: old and new
Question 5
A data = ' hi '
B cleaned = data.strip
C print('Cleaned:', cleaned)
D print('Done')
Line B — Missing parentheses: strip is a method, call it with strip()
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?