Report Bug

Qus

What will be the output of the following code?

for i in range(1,5):
    if i == 3:
        break
    print(i, end=" ")
Qus

निम्न code का output क्या होगा?

for i in range(1,5):
    if i == 3:
        break
    print(i, end=" ")


A. 1 2 3
B. 1 2 3 4
C. 1 2 4
D. 1 2


Solution
D. 1 2



Explanation
When i becomes 3, break terminates the loop before print() executes for 3. <br><br> i = 3 होने पर break loop को तुरंत समाप्त कर देता है, इसलिए केवल 1 और 2 print होते हैं।
Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad