adplus-dvertising
frame-decoration

Question

What is the output of the following?
i = 0
while i < 5:
    print(i)
    i += 1
    if i == 3:
        break
else:
    print(0)

a.

0 1 2 0

b.

0 1 2

c.

error

d.

none of the mentioned

Posted under Loops in Python Python

Answer: (b).0 1 2

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following?

Similar Questions

Discover Related MCQs