Courseiva

PCEP Control Flow, Loops, Lists and Logic Practice Question

A Python programmer is analyzing a list of integers named numbers. The programmer wants to create a new list that contains only the even numbers from numbers, each multiplied by 10. Which two of the following code snippets correctly produce the desired list? (Choose two.)

⚠ Common exam trap

The trap here is misreading the condition or misunderstanding list multiplication versus element-wise multiplication.

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

✓

result = [] for n in numbers: if n % 2 == 0: result.append(n * 10)

The desired output requires filtering even numbers and then multiplying each by 10. The explicit for-loop with append and the list comprehension both correctly perform this filter-and-transform operation. The other options either select odd numbers, fail to multiply, or multiply the list itself instead of its elements.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    result = [] for n in numbers: if n % 2 == 0: result.append(n * 10)

    Why this is correct

    This snippet initializes an empty list, iterates over each number, checks if it is even using the modulo operator, and if so appends the number multiplied by 10 to the result list. It correctly filters and transforms the data as required.

  • ✗

    result = [n * 10 for n in numbers if n % 2 != 0]

    Why it's wrong here

    This list comprehension selects numbers where n % 2 != 0, which are odd numbers, not even. It then multiplies them by 10. This produces the opposite of the desired result, containing transformed odd numbers instead of even ones.

  • ✗

    result = [] for n in numbers: if n % 2 == 0: result.append(n) n = n * 10

    Why it's wrong here

    This snippet appends the original even number to result and then reassigns n to n * 10, but the reassignment happens after appending and does not affect the list. The result list contains the original even numbers, not multiplied by 10.

  • ✓

    result = [n * 10 for n in numbers if n % 2 == 0]

    Why this is correct

    This list comprehension iterates over numbers, includes only those where n % 2 == 0, and multiplies each by 10. It is a concise and correct way to achieve the filtering and transformation in a single expression.

  • ✗

    result = [n for n in numbers if n % 2 == 0] * 10

    Why it's wrong here

    This creates a list of even numbers and then multiplies the entire list by 10, which repeats the list ten times rather than multiplying each element. This does not produce the desired list of even numbers each multiplied by 10.

About these practice questions

Courseiva writes every PCEP question from scratch — 482 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

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.