# Print 1 to 10 in Python using While Loop

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