You score exactly 60 in a Manchester quiz. Will the app put you through?
You need at least sixty points to reach the next round of a quiz in Manchester. You score exactly sixty. Will the quiz app let you through, or will it make you try again?
You already know how an expression can work out a number. Here, integer division splits one hundred and eighty team points into three equal shares. Your share is sixty. The next line stores the qualifying mark, also sixty.
Use two equals signs to compare score with cutoff. Both values are sixty, so the result is True. That's a Boolean value. Assign the comparison to a flag called at cutoff, so the flag stores whatever result the test gives.
Now your score drops to fifty-nine and the cutoff is still sixty. What does Python store in the at cutoff flag when it tests whether the two values are equal? Pick an answer.
Each column compares a different score with sixty. The first two rows test equal and not equal. Next, less than and greater than both give False at sixty. The last two rows add ‘or equal to’, so both give True at sixty as well as on their respective sides.
Store forty-eight as the score and forty-eight as the cutoff. ‘At least’ includes the cutoff, so use greater than or equal to. The test gives True. Store that result in qualifies. The if statement checks the flag. Because it's True, the indented line runs and displays ‘Through’.
This time you need at least seventy-two points, and you score exactly seventy-two. Which comparison should you store in the qualifies flag so the if statement lets you through at seventy-two and at higher scores? Pick an answer.
Look at the top row. Assignment uses one equals sign and the equality test uses two. A single equals sign doesn't check for a match. It makes score hold the cutoff value. Two equals signs give you True or False without changing either value.
An AQA-style question might ask: explain why Try again is displayed. The score is fifty-nine and the cutoff is sixty. The comparison gives False, which is stored in qualifies. The if block is skipped, so the else block displays Try again.