arr=[10,20,30,40,50]arr[1],arr[-1]=arr[-1],arr[1]print(arr)
Standard input is empty
[10, 50, 30, 40, 20]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!