nerdexam
Python_Institute

PCEP-30-02 · Question #311

Consider the following code. ``python for n in range(1, 6, 1): print(??? * 5) ` What would you insert instead of ???, so that the program prints the following pattern to the monitor? ` 11111 22222…

The correct answer is C. str(n). See the full explanation below for the reasoning.

Question

Consider the following code.
for n in range(1, 6, 1):
 print(??? * 5)
What would you insert instead of ???, so that the program prints the following pattern to the monitor?
11111
22222
33333
44444
55555

Options

  • A-1
  • Bn
  • Cstr(n)
  • D1
  • E2

How the community answered

(28 responses)
  • A
    7% (2)
  • B
    4% (1)
  • C
    86% (24)
  • E
    4% (1)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice