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 -= 2
print (x)

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

Answer: b
Explanation: The loop is entered twice

Join The Discussion