nerdexam
Python_Institute

PCEP-30-02 · Question #292

Which of the following for loops would output the below number pattern? `` 11111 22222 33333 44444 55555 ``

The correct answer is A. for i in range(1, 6): print(str(i) * 5). See the full explanation below for the reasoning.

Question

Which of the following for loops would output the below number pattern?
11111
22222
33333
44444
55555

Options

  • Afor i in range(1, 6): print(str(i) * 5)
  • Bfor i in range(1, 5): print(str(i) * 5)
  • Cfor i in range(0, 5): print(str(i) * 5)
  • Dfor i in range(1, 6): print(i, i, i, i, i)

How the community answered

(26 responses)
  • A
    85% (22)
  • B
    4% (1)
  • C
    4% (1)
  • D
    8% (2)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice