AQA GCSE Computer Science June 2025 Paper 1, Question 2: the loyalty card
AQA 8525 June 2025 Paper 1, Question 2: complete a Python program that gives a free biscuit every 4th stamp, a pastry every 5th and a cake at 20, then write a program that totals the value of the free items. Worked through, with both programs to run.
Question 2 of the AQA GCSE Computer Science Paper 1 sat on 12 May 2025 (8525/1B, the Python paper) has two parts: fill three gaps in a Python program (3 marks), and write a short program of your own (4 marks).
We do not copy the exam paper here. Open it beside this page: AQA June 2025 Paper 1B question paper (PDF). When you have finished, check the mark scheme too.
The question in short
A coffee shop stamps a card for every drink. Every 4th stamp earns a free biscuit. Every 5th stamp earns a free pastry. The 20th stamp earns a free cake, and nothing else. For each of the first 20 drinks the program prints one of: Free biscuit, Free pastry, Free cake or Nothing free.
The program loops i from 1 to 20. It tests i % 20 == 0 for the cake. Then there is an elif with its condition missing, which prints Free pastry. Then elif i % 4 == 0: with its print missing. Then else: with its print missing.
Part 1: the three gaps
- The missing condition:
i % 5 == 0. Every 5th stamp means the stamp number divides by 5 with no remainder. - Under
elif i % 4 == 0:goesprint("Free biscuit"). - Under
else:goesprint("Nothing free").
Why is the cake tested first? 20 divides by 4 and by 5 as well. If the biscuit or pastry test came first, stamp 20 would never reach the cake. In an elif chain the most specific case goes at the top.
Part 2: the value of the free items
A biscuit is worth £1, a pastry £2.50 and a cake £3. Get the number of each from the user, then calculate and output the total value.
biscuits = int(input("Free biscuits: "))
pastries = int(input("Free pastries: "))
cakes = int(input("Free cakes: "))
total = biscuits * 1 + pastries * 2.5 + cakes * 3
print(total)
The four marks: one input stored; all three inputs stored; the right calculation; the total output. Any error caps it at 3.
Where the marks are lost
i / 5 == 0. Division is never 0 for these numbers. "Every 5th" is a remainder test, and the remainder operator is%.i == 5. That is only the 5th stamp, not the 10th or 15th.- Missing brackets or quotes in the two
printlines. The messages are strings. £2.50in the calculation. A pound sign is not part of a number. Write2.5.- No
int."3" * 2.5is an error.
Run it
Both parts. First the card, stamp by stamp, counting the free items. Then the value of what was given away, worked out from those counts.
The program
from bugbot import *
connect()
biscuits = 0
pastries = 0
cakes = 0
i = 1
while i <= 20:
if i % 20 == 0:
print(i, "Free cake")
cakes = cakes + 1
elif i % 5 == 0:
print(i, "Free pastry")
pastries = pastries + 1
elif i % 4 == 0:
print(i, "Free biscuit")
biscuits = biscuits + 1
else:
print(i, "Nothing free")
i = i + 1
total = biscuits * 1 + pastries * 2.5 + cakes * 3
print("Total value", total)
Questions
What are the answers to AQA GCSE Computer Science 2025 Paper 1 Question 2.1?
i % 5 == 0, then print("Free biscuit"), then print("Nothing free").
How do I test for every nth item in a loop?
Use the remainder operator. i % n == 0 is true when i is a multiple of n, so it picks out every nth value of i.
Why does the order of elif branches matter?
Only the first true branch runs. If a general test such as i % 4 == 0 came before a specific one such as i % 20 == 0, the specific case would never be reached, because 20 is also a multiple of 4.
More from this paper
- Question 1: Operators in a short program, and a trace of a while loop that doubles 7 marks
- Question 3: A coaching cost with three price bands 8 marks
- Question 4: Validate a name by length until it is accepted, test data, and a username flowchart 13 marks
- Question 5: Data types, and five inputs rewritten as a loop with one 8 marks
- Question 6: Show a bubble sort and a merge, compare them, and justify a binary search 10 marks
Every AQA 8525 question we have worked · Guide: Logic gates and truth tables explained
Learn it step by step
- F2.3 else, elif and Boolean operators Decisions and loops
- F1.9 Arithmetic operators Programming basics
- F1.7 Input from the user Programming basics
This is our own explanation of a published exam question. It is not written or endorsed by AQA, and the question paper and mark scheme remain AQA's copyright. Read them on AQA's site with the links on this page.