Saturday, May 18, 2019

Abhijeet Pal: Python Program To Print Numbers From 1 to 10 Using While Loop

Problem Definition

Create a Python program to print numbers from 1 to 10 using a while loop.

Solution

In programming, Loops are used to repeat a block of code until a specific condition is met. The While loop loops through a block of code as long as a specified condition is true.

To Learn more about working of While Loops read:

Program

i = 1
while(i<=10):
    print(i)
    i += 1

Output

1
2
3
4
5
6
7
8
9
10

The post Python Program To Print Numbers From 1 to 10 Using While Loop appeared first on Django Central.



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...