Python | Output Type | Question 5

What is the output of the following program :

filter_none

edit
close

play_arrow

link
brightness_4
code

i = 0
while i < 3
    print
    i += 1
else
    print 0

chevron_right


(A) 0 1 2 3 0
(B) 0 1 2 0
(C) 0 1 2
(D) Error


Answer: (B)

Explanation: The else part is executed when the condition in the while statement is false.

Quiz of this Question

My Personal Notes arrow_drop_up