PCEP Control Flow, Loops, Lists and Logic Practice Question
A game developer writes a loop to process a list of player scores: `scores = [45, 82, 67, 91]`. She wants to print only the scores that are greater than 80. Which loop correctly accomplishes this?
⚠ Common exam trap
The trap here is mixing up the comparison operators `>` and `<`, or using `>=` which includes the boundary value when the requirement is strictly greater.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
for score in scores: if score > 80: print(score)
To print only scores greater than 80, the loop must iterate over all scores and use an `if` statement with the `>` operator to print those that satisfy the condition. The correct snippet does exactly that, printing 82 and 91. Other options use incorrect comparison operators or misplaced print statements.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
for score in scores: if score < 80: print(score)
Why it's wrong here
This condition selects scores less than 80, which would print 45 and 67. The requirement is to print scores greater than 80, so this reverses the logic. The comparison operator is incorrect for the intended filter.
- ✗
for score in scores: if score >= 80: print(score)
Why it's wrong here
The `>=` operator includes scores equal to 80. While none of the given scores are exactly 80, the specification says 'greater than 80', which excludes 80. Using `>=` would incorrectly include 80 if it were present, making the filter slightly too permissive.
- ✓
for score in scores: if score > 80: print(score)
Why this is correct
This loop iterates over each score, and the `if` statement filters those greater than 80. It will print 82 and 91. This is the straightforward way to apply a condition inside a loop and print matching elements.
- ✗
for score in scores: print(score) if score > 80: break
Why it's wrong here
This prints every score regardless of the condition, and the `break` only stops the loop after printing a score greater than 80. It would print 45, 82 and then break, missing 67 and 91. The logic does not filter; it terminates prematurely.
Go deeper
Related to this question
About these practice questions
This PCEP question is part of Courseiva's 482-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Python Institute exam blueprint
This PCEP practice question is part of Courseiva's free Python Institute certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCEP exam.