Counting the effects of two chain errors

An arcade assigns bonus tokens from a whole-number score between 0 and 100 inclusive. The intended schedule is 2 tokens for scores 0–39, 5 tokens for scores 40–79, and 9 tokens for scores 80–100.


Two proposed Python versions appear below. For each version separately, count how many of the 101 possible scores receive an incorrect bonus. Give both counts as exact integers.


Python
# Version A
if score >= 40:
    bonus = 5
elif score >= 80:
    bonus = 9
else:
    bonus = 2


Python
# Version B
if score > 80:
    bonus = 9
elif score >= 40:
    bonus = 5
else:
    bonus = 2
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Chained Decisions Questions: