Home > other >  Introduction to the problem
Introduction to the problem

Time:09-25

A=[1, 2, 3, 4, 5]
N=len (a)
For I in range (int (len (a)/2)) :
A [I], a [N - I - 1)=a [N - I - 1], a [I]
Print (a)

Inside the loop didn't understand

CodePudding user response:

 a=[1, 2, 3, 4, 5] 
N=len (a)
For I in range (int (len (a)/2)) :
A [I], a [N - I - 1)=a [N - I - 1], a [I]
Print (a [I], a [N - I - 1])
Print (a)


5 1
4 2
[5, 4, 3, 2, 1]

* * * * * * Repl Closed

Don't understand it is understood that the print is two interchangeable
  • Related