Computer Science, asked by reenaranivaid, 4 months ago

x = 2

for i in range(x):

x -= 2

print (x)​

Answers

Answered by anindyaadhikari13
1

Required Answer:-

Given C∅de:

x=2

for i in range(x):

   x-=2

   print(x)

To Find:

  • Output.

Output:

0

-2

Explanation:

  • The given loop iterates twice irrespective of change in value of a.
  • After each iteration, value of a is decremented by 2 and then its value will be displayed.
  • a becomes 0 at first. 0 is printed with a new line. Then, a becomes -2. -2 is printed.

Refer to the attachment.

Similar questions