🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित का आउटपुट क्या है?

What is the output of the following ?

for i in range(10):
     if i == 5:
         break
     else:
          print(i)
else:
     print("Here")
A
0 1 2 3 4 Here
B
0 1 2 3 4 5 Here
C
0 1 2 3 4
D
1 2 3 4 5
Explanation

Sure! Here's a simple breakdown:

  • The for loop runs from i = 0 to i = 9.
  • When i reaches 5, the break statement stops the loop.
  • The numbers 0 1 2 3 4 are printed because the loop ends before i reaches 5.
  • The else after the loop is not executed because the loop was stopped with break.

Output:

(C) 0 1 2 3 4

Correct Answer: C) 0 1 2 3 4

Latest Updates