nerdexam
Python_Institute

PCEP-30-02 · Question #309

How many stars will the following snippet print to the monitor? ``python i = 0 while i <= 5: i += 1 if i % 2 == 0: break print('*') ``

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

Question

How many stars will the following snippet print to the monitor?
i = 0
while i <= 5:
 i += 1
 if i % 2 == 0:
 break
 print('*')

Options

  • Athree
  • Bzero
  • Cone
  • Dtwo

How the community answered

(40 responses)
  • A
    8% (3)
  • B
    5% (2)
  • C
    85% (34)
  • D
    3% (1)

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice