Single lesson · Written for OCR A Level (H446)

String manipulation – OCR A Level Computer Science lesson (H446)

Students learn to use length, substring, case conversion, character codes and concatenation in Python and OCR pseudocode.

Also in a bundle Programming Foundations and Computational Thinking – OCR A Level Computer Science lessons (H446) 16 lessons for £45 · save 29% on buying separately

Lesson 6 of 16 in unit 12.2 Programming Foundations and Computational Thinking, taught in Year 12, Autumn 1. It answers one big question: How can a program take text apart and build it again?

By the end, students can use length, substring, case conversion, character codes and concatenation in Python and OCR pseudocode.

The Build (the main task)
Write a function in Python and OCR pseudocode that takes a Fernbridge CycleShare rider's first name, surname and member number and returns a username made of the first three letters of the surname in upper case, the first initial in upper case and the last four digits of the member number (6 marks).
Support version
Part-filled function with the header and return line given, and an index table showing each position of 'OKAFOR' and '20587341'.
Challenge
Extend the function so that a surname shorter than three letters is padded with 'X', and state the precondition the member number must meet.
Real-world link
Fernbridge CycleShare gives every member a username for its app.
Key words
String, Concatenation and Manipulate, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“In OCR pseudocode, substring(2, 3) gives the characters from position 2 to position 3”; “The first character of a string is at position 1”.
OCR H446 specification
1.4.1 (a) (primitive data types: integer, real (floating point), character, string and Boolean); 2.2.1 (a).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Students need computers for the main task.

Also sold in the Programming Foundations and Computational Thinking unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes

More for A Level Computer Science

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.