AQA GCSE Computer Science June 2024 Paper 1, Question 6: the late essay program

AQA 8525 June 2024 Paper 1, Question 6: write a Python program that totals three essay marks, takes 10 off for one late essay, halves the total for more than one, and never goes below 0. A model answer, the seven marks explained, and the program to run.

Past paper questionAQA 8525/1BJune 2024 Paper 17 marksWrite a program

Question 6 of the AQA GCSE Computer Science Paper 1 sat on 15 May 2024 (8525/1B, the Python paper) is a 7 mark "write a program" question. The selection is simple. The mark people miss is the last rule: the total must not go below 0.

We do not copy the exam paper here. Open it beside this page: AQA June 2024 Paper 1B question paper (PDF). When you have finished, check the mark scheme too.

The question in short

Three integer variables, e1, e2 and e3, already hold the marks for three essays. The program should:

  • get the user to enter how many essays were handed in late, and store it;
  • work out the total of the three marks;
  • if exactly one essay was late, take 10 off the total;
  • if more than one was late, halve the total;
  • never let the total be less than 0;
  • output the total.

A model answer

late = int(input("How many essays were late? "))
total = e1 + e2 + e3
if late == 1:
    total = total - 10
elif late > 1:
    total = total / 2
if total < 0:
    total = 0
print(total)

Do not give e1, e2 and e3 values. The question says they already have them.

Where the seven marks are

Two marks are for design: meaningful variable names, and a selection that checks whether the total is below zero.

Five marks are for a program that works:

  • the number of late essays input and stored as a number;
  • the three marks added, and then reduced by 10 or halved;
  • correct conditions for "one late" and "more than one late";
  • stopping the total going below 0;
  • the total output in the right place, after every calculation.

Any error caps you at 6.

Where the marks are lost

  • No check for a negative total. Marks of 2, 3 and 1 with one late essay give 6 - 10 = -4. That check is two of the seven marks: a design mark for having it, and a logic mark for getting it right.
  • if late >= 1 for the first rule. That also catches 2 and 3. "Only one" is == 1.
  • Two ifs that can both run. if late >= 1: followed by if late > 1: takes 10 off and halves. Use elif, or make the conditions exclusive.
  • Printing before the zero check. The mark scheme rejects an output that comes before the last calculation.
  • No int. input gives text, and "1" == 1 is False.

Run it

Here the three marks are set at the top, so that the program can run. The robot drives the final total in centimetres.

With marks of 20, 15 and 25: enter 0 for 60, 1 for 50, 2 for 30.0. Then change the marks to 2, 3 and 1 and enter 1: the total is 0, not -4.
The program
from bugbot import *
connect()

# in the exam these already have values
e1 = 20
e2 = 15
e3 = 25

late = int(input("How many essays were late? "))
total = e1 + e2 + e3
if late == 1:
    total = total - 10
elif late > 1:
    total = total / 2
if total < 0:
    total = 0
print(total)
forward(60, distance=min(total, 60))
Put this demo on your own site

Paste it into a school website, Moodle, Google Sites or a blog. More options on the embed page.

Questions

What is the answer to AQA GCSE Computer Science 2024 Paper 1 Question 6?

Input the number of late essays as an integer. Add e1, e2 and e3. If late is 1, subtract 10. Else if late is more than 1, halve the total. If the total is below 0, set it to 0. Print the total.

How do I stop a value going below zero?

After the calculation, test it: if total < 0 then set total to 0. In Python, total = max(total, 0) does the same in one line.

When should I use elif and not a second if?

When only one of the branches should run. With two separate ifs, a value of 2 could match both "at least one" and "more than one". With if and elif, the second is only tested when the first was false.

More from this paper

Every AQA 8525 question we have worked · Guide: Logic gates and truth tables explained

Learn it step by step

  1. F2.3 else, elif and Boolean operators Decisions and loops
  2. F1.7 Input from the user Programming basics
  3. F13.4 Programming questions Exam preparation
Open the lessons

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.