**Python Programs**

Python Flow Control

➤ Even Number in Python

➤ Odd Number in Python

➤ Even Odd Program

➤ Largest of 3 Numbers

➤ Leap Year Program

➤ Multiplication Table

➤ Factors of a Number

➤ Prime Factors in Python

➤ Factorial of a Number

➤ Factorial using Function

➤ Math.factorial() in Python

➤ Factorial using Recursion

➤ LCM of Two Numbers

➤ HCF/GCD of 2 Numbers

➤ Solve Quadratic Equation

➤ Sum of Digits of a Number

➤ Sum of N Natural Numbers

➤ Fibonacci Series in Python

➤ Fibonacci Series – Recursion

➤ Simple Calculator in Python

➤ Perfect Square in Python

➤ Absolute Value in Python

Conversion Programs

➤ Celsius to Fahrenheit

➤ Fahrenheit to Celsius

➤ Decimal to Binary

➤ Binary to Decimal

➤ Decimal to Octal

➤ Octal to Decimal

➤ Decimal to Hexadecimal

➤ Hexadecimal to Decimal

Array Programs

➤ Linear Search in Python

➤ Binary Search in Python

In this post, we will discuss how to print 1 to 10 in Python using while loop. Also, develop a program to print 1 to 10 without loop in python.

## While Loop to Print 1 to 10 in Python

We will take a range from 1 to 11. Then, print all numbers in an interval 1 to 11 using the While Loop.

Program description:- **Python program to print numbers from 1 to 10 using while loop**

```
# Python program to print numbers from 1 to 10
print('Numbers from 1 to 10:')
n = 1
while n <= 10:
print(n, end=' ')
n = n+1
```

Output:-

Numbers from 1 to 10:

1 2 3 4 5 6 7 8 9 10

## Print 1 to 10 in Python Without Loop

This python program also performs the same task but in this program, we print 1 to 10 without the loop. To solve this problem, we can use recursion techniques.

A method that contains a call to itself is called the recursive method. A technique of defining the recursive method is called recursion. The recursive method allows us to divide the complex problem into identical single simple cases that can be handled easily. This is also a well-known computer programming technique: divide and conquer.

```
# Python program to print numbers from 1 to 10
def print_num(n):
if n > 0:
print_num(n - 1)
print(n, end = ' ')
print('Numbers from 1 to 10:')
print_num(10)
```

Output:-

Numbers from 1 to 10:

1 2 3 4 5 6 7 8 9 10

Also See:- Print numbers from 1 to 100 in Python