Python program to print numbers from 1 to n and n to 1; Through this tutorial, i am going to show you how to print number from 1 to n and n to 1 in python.

In this tutorial, i will write a python program to print numbers from 1 to N and N to 1.

## Python Program to Print Numbers From 1 to N and N to 1

- Python program to print numbers from 1 to N using for loop
- Python program to print numbers from N to 1 using while loop

### Python program to print numbers from 1 to N using for loop

# Python program to print numbers from 1 to n n = int(input("Please Enter any Number: ")) print("The List of Natural Numbers from 1", "to", n) for i in range(1, n + 1): print (i, end = ' ')

Output

Please Enter any Number: 15 The List of Natural Numbers from 1 to 15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

### Python program to print numbers from n to 1 using while loop

# Python program to print numbers from n to 1 number = int(input("Please Enter any Number: ")) i = number while ( i >= 1): print (i, end = ' ') i = i - 1

Output

Please Enter any Number: 5 5 4 3 2 1

## Recommended Python Tutorials

**Recommended:-**Python Program to Add Two Numbers

**Recommended:-**Python Program to Calculate Simple Interest

**Recommended:-**Python Program to Find Average of n Numbers

**Recommended:-**Python Program to ASCII Value of Character

**Recommended:-**Python Program to Calculate Compound Interest

**Recommended:-**Python Program to Check Leap Year

**Recommended:-**Python Program To Print Number Pattern

**Recommended:-**Python Math Functions | Built-in Math Function

**Recommended:-**Python String Methods/Functions

**Recommended:-**List methods in Python

**Recommended:-**Python Remove First & Last Character from String

**Recommended:-**Python Convert String Lowercase to Uppercase

**Recommended:-**Python Program to Convert Uppercase to Lowercase

**Recommended:-**Python Program Find Length of String

**Recommended:-**Python Concatenate String and Variable (int float)

**Recommended:-**Python Trim String – rstrip(), lstrip(), strip()

**Recommended:-**Python Dictionary Methods with Example

**Recommended:-**Python Reverse String

**Recommended:-**Python String find() Method

**Recommended:-**Python Replace Character in String

**Recommended:-**Python Convert String to Float

**Recommended:-**Python String translate() Method Example

**Recommended:-**Python Convert String to List