Computer Science, asked by akshadavanve1432, 5 months ago

What is the output of following python code?
for i in range (5, 0.-2):
print(0)
Option
O 543210-1
543210
O 531
O 0134​

Answers

Answered by gothivarekarkhushi21
0

Answer:

o 531 is the ans for thpython code

Answered by vishakasaxenasl
0

Answer:

The output of the following python code:

531

Explanation:

The correct code should be according to the given options is follows:

for i in range (5, 0.-2):

         print(i)

According to the given options, 531 is the correct output.

  • The given for loop will be executed 3 times.
  • In the first iteration, 5 is printed.
  • In the second iteration, the value of i becomes 5-2 = 3
  • So 3 is printed.
  • Then in the third iteration, the value of i becomes 3-2=1
  • So 1 is printed.
  • After that, value of i becomes 1-2 = -1
  • But our condition is to run the loop till the value of i gets zero.
  • So the loop terminates here.
  • And the final output is 531.

#SPJ3

Similar questions