nerdexam
Python_Institute

PCEP-30-02 · Question #315

How many stars will the following snippet print to the monitor? ``python for i in range(1): print('') else: print('*') ``

The correct answer is C. two. See the full explanation below for the reasoning.

Question

How many stars will the following snippet print to the monitor?
for i in range(1):
 print('*')
else:
 print('**')

Options

  • Athree
  • Bone
  • Ctwo
  • Dzero

How the community answered

(29 responses)
  • A
    3% (1)
  • B
    17% (5)
  • C
    69% (20)
  • D
    10% (3)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice