The Pearson / Edexcel GCSE in Computer Science has a practical on-screen python exam which assesses your ability to read, understand, write and debug python code. In the actual exam you won’t have access to the Internet but you will have a copy of the Programming Language Subset which is a really useful reminder and reference guide.

There are a variety of different question styles you might get in the third question of the Edexcel GCSE Computer Science paper 2:

  • Code completion challenges where you have to fill in the blank spaces in code
  • Instructions to turn a flowchart into python code
  • Rearranging sections of code or choosing between multiple options for lines of code

This page has three practice Q4 style activities to help you prepare for the exam. In the actual exam you won’t be able to use an online IDE so these self marking activities are just designed to give you instant feedback as you practice and prepare for the exam. If you want to practice “offline”, you can download the questions and python files here:

The progress bar below shows how well you’ve done on each part of the three challenges. You can generate a PDF certificate to celebrate your progress if you click on the ✓ button next to where you enter your name.

Challenge 1: Palindrome detector

Suggested time: 20 minutes

A programmer is designing a program which should work out if a word that the user enters is a palindrome or not.

A palindrome is a word that is spelt the same forwards or backwards.

For example “RACECAR” spelt backwards is still “RACECAR” so it is a palindrome

Some of the lines of code in the program are mixed up and some parts of the code have been left blank. When the program has been completed it should run as shown below:

Example program output

Using the file below:

Amend the code to make the program work and produce the correct output.
You will need to rearrange some lines of code and fill in some blank spaces.
Do not change the functionality of the given lines of code.
Do not add any additional functionality

If this was a real question it would tell you to save your code as but you might want to save your code so you can show your teacher or come back to it later by pressing Ctrl + S or clicking on the icon that looks like this:

Save / share icon in lets you save your code