NIELIT O Level Exam

<p>What will be the output of the following Python code snippet?</p><pre>x = 2<br>for i in range(x):<br>&nbsp; &nbsp; x += 1<br>&nbsp; &nbsp; print (x)</pre>

What will be the output of the following Python code snippet?

x = 2
for i in range(x):
    x += 1
    print (x)


निम्नलिखित Python कोड स्निपेट का आउटपुट क्या होगा?

x = 2
for i in range(x):
    x += 1
    print (x)

A. 0 1 2 3 4 …

B. 3 4

C. 0

D. error एरर




Correct Answer is :

B. 3 4



Explanation
The loop is entered twice.
CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad