← ACARA Digital Technologies Years 5–6

Text (strings) as a data type

A string is text: a row of characters such as letters, digits, symbols and spaces, written inside quote marks like "cat". Even "5" is a string.

Understanding Text (strings) as a data type in ACARA Digital Technologies Years 5–6

What it does: The quote marks make 5 a string, so the computer treats it as a character, like a letter. The letter a, the space and the letter b are three characters. A space is a character too. Spaces count as characters. h, i, space, m, u, m makes 6. Strings are rows of characters. Characters can be letters, digits, symbols or spaces, like "Room 4!". A is a letter and 1 is a digit. Both are characters, so the string has 2.

Common mistakes: Pieces of text are joined with +. The + is missing before pet. It should be print(name + " has a " + pet). A string needs a quote mark at both ends. The closing quote is missing. It should be phrase = "hi there".

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 73–84) and word search (Modules 73–104).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which one is a string?
"cat"cat
Matches
name = cat
↓
The word cat has no quote marks, so it is not written as a string of text. It should be "cat".
Applying
Meanings
Term
string
Meaning
A string is text: a row of characters such as letters, digits, symbols and spaces, written inside quote marks like "cat". Even "5" is a string.
Practice
word = "cat"
Testing
Gaps
print((word))
Check Answer
Spots
2pet = "cat"
3print(name + " has a " pet)

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

The 'Octopus' badge — Multi-Tasker, 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. Which one is a string?
A. "cat" ✓
B. cat
A string is text inside quote marks. Without quote marks, cat would look like a name, not text.
2. How many characters are in the string "hi mum"?
A. 6 ✓
B. 5
Spaces count as characters. h, i, space, m, u, m makes 6.
3. Which one is text, not a number?
A. "42" ✓
B. 42
Digits inside quote marks are text. They are a string, so the computer treats them like letters.
4. What is the empty string?
A. " " (quote marks with a space inside)
B. "" (quote marks with nothing inside) ✓
The empty string has 0 characters. A string with a space inside has 1 character, because a space counts.
5. Which statement is true?
A. A string can only hold letters.
B. A string can hold letters, digits, symbols and spaces. ✓
Strings are rows of characters. Characters can be letters, digits, symbols or spaces, like "Room 4!".

Match the Pairs

"cat" → A string: text made of the characters c, a and t, written inside quote marks
"" → The empty string: text with no characters inside the quote marks
Digits inside quote marks are text, not a number to do sums with → "5"
Spaces count as characters in a string, so this sentence has 3 characters → "a b"
name = cat → The word cat has no quote marks, so it is not written as a string of text. It should be "cat".
word = "hello → The closing quote mark is missing. A string needs a quote mark at the start and at the end: "hello".

Key Term

string
A string is text: a row of characters such as letters, digits, symbols and spaces, written inside quote marks like "cat". Even "5" is a string.

Fill in the Blanks

1. word = "dog" print(type(word))
Hint: Type the function that reports what data type a value is.
2. pin = "1234" print(len(pin))
Hint: Type the name of the variable that holds the digits inside quote marks.
3. greeting = "hi there" print(len(greeting))
Hint: Type the function that counts every character, including the space.
4. empty = "" print(len(empty) == 0)
Hint: Type the number of characters in a string with nothing between its quote marks.
5. num = "5" print(type(num) == str)
Hint: Type the short name Python uses for the text data type.

Spot the Error

Question 1
A name = "Ava"
B pet = "cat"
C print(name + " has a " pet)
Line C — Pieces of text are joined with +. The + is missing before pet. It should be print(name + " has a " + pet).
Question 2
A word = "cat"
B phrase = "hi there
C print(phrase)
Line B — A string needs a quote mark at both ends. The closing quote is missing. It should be phrase = "hi there".
Question 3
A code = "2024"
B total = code + 1
C print(total)
Line B — Digits inside quote marks are text, so you cannot add 1 to them. Turn the text into a number first: total = int(code) + 1.
Question 4
A first = "go"
B space = " "
C msg = first + "now"
D print(msg)
Line C — A space counts as a character. Leaving out the space variable makes the text "gonow". It should be msg = first + space + "now".
Question 5
A text = ""
B text = text + "a"
C text = text + "b"
D print(len(text)
Line D — The brackets do not match. len( needs its own closing bracket and so does print(. It should be print(len(text)).

Student with a class code? Join your class →