Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

What will be the output of the following Python code snippet?
x = 2
for i in range(x):
x += 1
print (x)

What will be the output of the following Python code snippet?
x = 2
for i in range(x):
x += 1
print (x)
a) 0 1 2 3 4 …
b) 0 1
c) 3 4
d) 0 1 2 3

Answer: c
Explanation: Variable x is incremented and printed twice.

Join The Discussion