Question 7
Back to Exercise
A student with 95 marks should get "Distinction". Which statement correctly identifies the bug?
marks = 95
if marks >= 40:
print("Pass")
elif marks >= 75:
print("First class")
elif marks >= 90:
print("Distinction")
- A elif should be else if
- B The broadest condition (>= 40) is tested first, so the more specific branches are never reached; order them from highest to lowest Correct
- C marks must be a float
- D The last branch needs else
Correct Answer: Option B
Only the first true branch runs. Test >= 90, then >= 75, then >= 40.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!