Report Bug
Qus :

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

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

Qus

निम्नलिखित 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


Solution
B. 3 4



Explanation
The loop is entered twice.



Report Bug