निम्नलिखित का आउटपुट क्या है?
What is the output of the following ?
for i in range(10):
if i == 5:
break
else:
print(i)
else:
print("Here")
A)
B)
C)
D)
Explanation:
Sure! Here's a simple breakdown:
- The
for
loop runs fromi = 0
toi = 9
. - When
i
reaches 5, thebreak
statement stops the loop. - The numbers
0 1 2 3 4
are printed because the loop ends beforei
reaches 5. - The
else
after the loop is not executed because the loop was stopped withbreak
.
Output:
(C) 0 1 2 3 4