Strings and nested selection

About this lesson: Strings and nested selection

In short

Strings are sequences of characters, each with an index. Move the sliders to take a substring, and try changing case.

Strings and nested selection

What you'll explore

String handling: Length, substring, case
Strings are sequences of characters, each with an index. Move the sliders to take a substring, and try changing case.
Comparing strings: YES, Yes or yes?
Computers compare strings exactly, so "Yes" ≠ "yes". Convert to one case before comparing. Try each answer.
Selection with several branches: IF … ELSE IF … ELSE
Only the first true branch runs. Move the mark and step through.
Nested selection: An IF inside an IF
A ticket machine first checks age, then inside each branch checks another condition. Change the age and run it.
Check yourself: Substring
word ← "COMPUTER". Indexes start at 0.

Also in this lesson

  • Step by step
  • Watch out for these
  • More than the lesson
  • Stretch your brain
  • Try it yourself

Words to know

String
A sequence of characters.
Index
The position of a character.
Substring
Part of a string.
Concatenation
Joining strings together.
Nested selection
An IF inside another IF.
CASE
A statement that chooses between many values.

Sources

  • Python documentation: Text Sequence Type — str
  • Unicode Consortium: What is Unicode?
  • Raspberry Pi Foundation, Isaac Computer Science: string handling
  • BBC Bitesize, GCSE Computer Science: selection

An interactive lesson with a live experiment: move the sliders, press the buttons and answer quick questions. 5 short steps and a 8-question quiz. Part of the Family plan. Written and checked by Shalo Lab. Last updated 10 November 2026.

← Validation, verification and test data · Arrays: 1D and 2D →

All lessons in Term 3 · Computing · Age 14