Use of while loop in the Python 

Author: Al-mamun Sarkar Date: 2020-03-25 08:32:18

Use of while loop in the Python programming language. 

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


temp = 0
while n <= 100:
    temp = temp + n
    n = n + 1

print(temp)

 

Output:

1
2
3
4
5
6
7
8
9
10
4995