AQA GCSE Computer Science June 2023 Paper 1, Question 7: the theme park ticket program
AQA 8525 June 2023 Paper 1, Question 7: write a Python program that charges 15 pounds a person with 5 pounds off for groups of six or more. A model answer built line by line, the six marks explained, and the program to run.
Question 7 of the AQA GCSE Computer Science Paper 1 sat on 19 May 2023 (8525/1B, the Python paper) is the first "write a program" question on the paper. It is worth 6 marks and needs about six lines of Python. It is the friendliest programming question you will meet, so it is the one to get full marks on.
We do not copy the exam paper here. Open it beside this page: AQA June 2023 Paper 1B question paper (PDF). When you have finished, check the mark scheme too.
The question in short
A theme park charges £15 a person. A group of six or more gets £5 off the total. The program must:
- get the number of people from the user;
- work out the total at £15 each;
- take £5 off if there are six or more people;
- output the total.
Plan before you write
Turn each bullet into one line. That is all the planning a 6 mark question needs.
- Input, stored in a variable, converted to a whole number.
- Multiply by 15.
- An
ifwith the condition "six or more". - Inside the
if, subtract 5. - After the
if, print.
A model answer
people = int(input("How many people? "))
total = people * 15
if people >= 6:
total = total - 5
print(total)
Test it in your head with three numbers: one below the boundary, the boundary, and one above. 5 people is 75. 6 people is 90 - 5 = 85. 7 people is 105 - 5 = 100.
Where the six marks are
Two marks are for design. You get them for choosing the right tools, even if the syntax is wrong:
- storing the number of people that the user enters in a variable;
- using selection (an
if).
Four marks are for a program that works:
- multiplying the number of people by 15;
- a correct condition:
>= 6or> 5; - taking 5 off the total;
- outputting the total in a sensible place, after the discount.
One error anywhere caps you at 5. The examiner ignores the wording of your input prompt, and whether you have one at all.
Where the marks are lost
> 6. "Six or more" includes six. This is the classic slip on a boundary question. Say the condition out loud with the boundary number in it: "is 6 greater than 6?" No. So it is wrong.- No
int.inputgives you text."6" * 15in Python is the text666666666666666, not 90. - £5 off each person. The discount is off the group's total, once.
- Printing inside the
if. Then a group of three gets no output at all. Theprintgoes after theif, not inside it. - Working out the discount before the total exists. Order matters: total first, then the discount, then the output.
Run it
Type a number of people when it asks. The robot's light goes green if the group got the discount.
The program
from bugbot import *
connect()
people = int(input("How many people? "))
total = people * 15
if people >= 6:
total = total - 5
led("green")
print(total)
Now change it
The park adds a second offer: groups of twelve or more get £15 off instead of £5. Change the program. You will need elif, and you will need to think about which condition to test first.
Answer
Test the bigger group first. If you test for six or more first, a group of twelve matches it and never reaches the second test.if people >= 12:
total = total - 15
elif people >= 6:
total = total - 5
Questions
What is the answer to AQA GCSE Computer Science 2023 Paper 1 Question 7?
Read the number of people with int(input()), multiply it by 15, subtract 5 if the number of people is 6 or more, then print the total. Five lines of Python get all six marks.
Do I lose marks for syntax errors in AQA programming questions?
The design marks are given for choosing the right techniques even if the syntax is wrong. The program logic marks need working code, and any error caps the question at one below full marks. Small things such as capital letters and the wording of prompts are ignored.
Should I write a prompt inside input() in the exam?
You can, but you do not have to. AQA mark schemes ignore whether an input statement has a message. Write one if the question asks for it.
More from this paper
- Question 12.2: Write your own linear search 7 marks
- Question 13: Validate a grid reference until it is correct 6 marks
- Question 15: Share a bill: loop until it is paid, then report the tip 8 marks
- Question 16: A dice game to 21 with random numbers 11 marks
Every AQA 8525 question we have worked
Learn it step by step
- F2.2 Selection: if Decisions and loops
- F1.7 Input from the user Programming basics
- F13.4 Programming questions Exam preparation
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.