nerdexam
Python_Institute

PCEP-30-02 · Question #331

Consider the following code. for i in range(5, 0, ???): print(i, i, i, i, i) What would you insert instead of ???, so that the program prints the following pattern to the monitor? 5 5 5 5 5 4 4 4 4…

The correct answer is B. -1. See the full explanation below for the reasoning.

Question

Consider the following code. for i in range(5, 0, ???): print(i, i, i, i, i) What would you insert instead of ???, so that the program prints the following pattern to the monitor? 5 5 5 5 5 4 4 4 4 4 3 3 3 3 3 2 2 2 2 2 1 1 1 1 1

Options

  • ANone
  • B-1
  • C0
  • D1

How the community answered

(58 responses)
  • A
    17% (10)
  • B
    72% (42)
  • C
    3% (2)
  • D
    7% (4)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice