nerdexam
Python_Institute

PCEP-30-02 · Question #359

Arrange the code boxes in the correct positions in order to obtain a loop which executes its body with the level variable going through values 5, 3, and 1 (in the same order).

The correct loop definition to iterate through values 5, 3, and 1 is: for level in range(5, 0, -2):

Module 3: Boolean Values, Conditional Execution, Loops, Lists and List Processing, Logical and Bitwise Operations

Question

Arrange the code boxes in the correct positions in order to obtain a loop which executes its body with the level variable going through values 5, 3, and 1 (in the same order).

Explanation

The correct loop definition to iterate through values 5, 3, and 1 is: for level in range(5, 0, -2):

Topics

#for loop#range function#step parameter#loop construction

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice