Question 266 of 498
PCEP Control Flow, Loops, Lists and Logic Practice Question
A programmer wants to create a list of even numbers from 0 to 10 inclusive. Which list comprehension is correct?
⚠ Common exam trap
Python Institute often tests the distinction between `range(0,11)` and `range(0,10)` to catch candidates who forget that the stop value is exclusive, and the use of truthy/falsy values in conditions (e.g., `if x%2` instead of `if x%2==0`) to confuse even vs. odd selection.
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
✓
[x for x in range(0,11) if x%2==0]
It uses `range(0,11)` to generate numbers from 0 to 10 inclusive, and the condition `if x%2==0` selects only even numbers (where the remainder when divided by 2 is 0). This matches the requirement exactly.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
[x for x in range(0,11) if x%2==0]
Why this is correct
Correct condition for even.
- ✗
[x for x in range(0,10) if x%2==0]
Why it's wrong here
Excludes 10.
- ✗
[x for x in range(0,11) if x%2]
Why it's wrong here
Non-zero values are truthy, gives odd numbers.
- ✗
[x for x in range(0,11) if x%2==1]
Why it's wrong here
Gives odd numbers.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 30, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.