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 fifth question of the Edexcel GCSE Computer Science paper 2 tends to involve filling in the gaps to complete a partially coded solution. The questions will often expect you to:
- Writing data to a file
- String formatting
- Working with lists (1d and 2d)
- Loading data from a file
This page has three practice Q5 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: Dinosaurs
Suggested time: 25 minutes
A program is needed to create a text file with details about different dinosaurs.
The program should create a text file called dinosaurs.txt and store details of the name, height (in m) and whether or not each dinosaur is a vegetarian.
This is what the text file should look like when the program runs successfully:
The program needs to be amended to meet these requirements:
- add a Brontosaurus to the list of records
- use commas to separate fields
- write each record to a separate line in an output file
Using the file Q05.py below:
Amend the code to process the list of records to generate the output file.
Do not add any additional functionality
If this was a real question it would tell you to save your code as Q05_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: