Courseiva
Control Flow, Loops, Lists and LogicmediumMultiple ChoiceObjective-mapped

PCEP Control Flow, Loops, Lists and Logic Practice Question

A developer needs to implement a loop that prints numbers from 10 down to 1. Which loop correctly achieves this?

⚠ Common exam trap

Python Institute often tests the exclusive nature of the stop argument in `range()`, leading candidates to forget that the stop value is never included in the sequence.

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 i in range(10, 0, -1): print(i)

`range(10, 0, -1)` generates numbers from 10 down to 1 inclusive. The start is 10, the stop is 0 (exclusive), and the step is -1, so the sequence is 10, 9, 8, ..., 1. 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.

  • for i in range(10, 0, -1): print(i)

    Why this is correct

    Correct; step -1 from 10 down to 1.

  • for i in range(10, 0): print(i)

    Why it's wrong here

    Empty range; default step=1, start>stop.

  • for i in reversed(range(1, 10)): print(i)

    Why it's wrong here

    Prints 9 to 1, not 10.

  • for i in range(10, 1, -1): print(i)

    Why it's wrong here

    Prints 10 to 2 (stop exclusive).

About these practice questions

Courseiva writes every PCEP question from scratch — 498 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 by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.