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.

The last question of the Edexcel GCSE Computer Science paper 2 tends to involve writing a program starting from only the blank template structure:

  • Writing data to a file
  • String formatting
  • Working with lists (1d and 2d)
  • Loading data from a file

This page has three practice Q6 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. It’s worth noting that it’s really hard to write self marking versions of Q5 and Q6 as there are often many different ways to write the code. Hopefully this is still useful practice.

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: Turtle face

Suggested time: 30 minutes

A text file is provided which describes the shapes used to draw a picture. An artist would like a program which can read in the data from the file and draw it on screen.

The file should read in each line of the text file. An example of the text file is shown below:

Example text file

A valid line of the text file starts with the word circle. Anything that does not start with the word circle is considered invalid and the program should display a message saying that it has been ignored.

Valid lines of the text file should also contain the colour of the circle, the x and y coordinate and the radius of the circle.

For example, when the program processes the text file above, it should display the following output:

Example program output

Using the file Q06.py below:

Amend the code to read the text file and display the circles and messages as shown above.

You should use constants, local variables and sub programs, whitespace and comments.
Do not add any additional functionality

If this was a real question it would tell you to save your code as Q06_FINISHED.py 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 create.withcode.uk lets you save your code