Python program to print 1 to 10 numbers using while loop

0
219
Python program will print 1 to 10 numbers using while loop

In this article, we are going to create a Python program to print 1 to 10 numbers using a while loop In computer programming, a loop is a set of statements that are repeated until a certain condition is satisfied. The basic purpose of the loop is to repeat the code according to our program requirements.

At first, we have given the number variable 1. After that, we use the while condition and give the statement in the next line we print the number at the last line we have to add 1 number variable until the condition is satisfied.

While Loop Python Program code

number = 1

while number <= 10:
  print(number, end=" ")
  number = number + 1

Output

1 2 3 4 5 6 7 8 9 10

if you have problem-related to the above program ask me on social media

Also, Read

Python Program to Remove Empty Strings from a List

LEAVE A REPLY

Please enter your comment!
Please enter your name here