Use of while loop in the Python 

Use of while loop in the Python 

Instructor-svg Al-Mamun Sarkar
Mar 25 , 2020

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

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram