Revise Computing
Revision notesQuestionsFor schools
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/String Manipulation

Substring slicing

301.11 String Manipulation

Practise exam questions

String Manipulation — Note 2 of 4

Extract part of a string.

What you need to know

Slicing extracts a portion of a string using [start:end]. The start index is included, the end index is excluded. Indices start at 0.

What to know

  • text[0] is the first character
  • text[0:3] gives characters at index 0, 1, 2
  • text[-1] is the last character
  • text[:3] means from start to index 2
  • text[3:] means from index 3 to the end

Code examples

Slicing strings
python
word = "Python"
print(word[0])     # P
print(word[0:3])   # Pyt
print(word[-1])    # n
print(word[2:])    # thon
← Previous noteString length301.11 String ManipulationNext note →Case conversion301.11 String Manipulation

Back to String Manipulation

Specification notes for programming are in Paper 2.

String Manipulation

Note 2 of 4

  1. 1String length
  2. 2Substring slicing
  3. 3Case conversion
  4. 4String validation
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Privacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).