Home » Programming Language (coding) » Python MCQs » What will be the output of the following Python code? i = 0 while i < 3: print(i) i += 1 else: print(0)

What will be the output of the following Python code? i = 0 while i < 3: print(i) i += 1 else: print(0)

Study the following program:

i = 0
while i < 3:
    print(i)
    i += 1
else:
    print(0)

A. 0 1
B. 0 1 2
C. 0120
D. 0123

Correct Answer: Option C. 0 1 2 0 

Discussion Board:

Take Part in Discussion:

Your email address will not be published.

Solve : *
8 + 1 =