GCSE Computer Science
Python strings โ GCSE Computer Science
What is a string?
A string is a sequence of characters. Every character has a position โ an index โ starting from zero. That means strings and lists share a fundamental property: both are ordered sequences that you can access by index. The skills transfer directly.
In GCSE Computer Science, string manipulation questions test whether students can work with text programmatically โ extracting parts of a string, measuring its length, combining strings together. These operations appear on every exam board.
Length and indexing
name = "Python"
print(len(name)) # 6
print(name[0]) # P
print(name[5]) # n
print(name[-1]) # n (last character)
len() returns the number of characters. Indexing works the same way as lists โ zero-based, left to right. Negative indices count from the end: name[-1] is the last character, name[-2] is the second to last.
Substrings
word = "Computer"
print(word[0:4]) # Comp
print(word[4:]) # uter
print(word[:3]) # Com
A substring is a slice of a string. word[0:4] gives you characters at index 0, 1, 2, and 3 โ the end index is excluded. This is consistent with how range() works: the stop value is never included. That pattern appears throughout Python.
Concatenation and string methods
first = "Python"
last = "Coach"
full = first + " " + last
print(full) # Python Coach
print(full.upper()) # PYTHON COACH
print(full.lower()) # python coach
Concatenation joins strings with +. String methods like .upper() and .lower() return a new string โ they don't change the original. GCSE exams also test .strip() (removes whitespace) and occasionally .replace().
What examiners actually test
String questions fall into three categories: length and indexing (what does name[2] return?), slicing (what does word[1:4] return?), and concatenation or method application. The slice end-index being excluded is the most consistently tested edge case โ word[0:4] gives four characters, not five.
Want structured Python lessons? Python Coach covers strings and 26 other lessons with 195 challenges โ free 60 teaching day trial.
Start learning →