In computation using python programming language we often have to do summation. Summation equation appears often in scientific or engineering courses. Often the summation in python programing language is implemented using the for loop. Here we show a summation equation implemented with while loop in python.

Suppose we have the summation equation as follows.

In one of previous tutorial The if, for and while statement in Python programming language we showed how to implement it using for loop. Now the following code implements this summation equation using while loop.

N = 5

x = 0

k = 0

while k != N+1:

x += 2*k

k = k+1

print(x)

The result is 30

For book see Download An Introduction to Python and Computer Programming PDF free.

Suppose we have the summation equation as follows.

In one of previous tutorial The if, for and while statement in Python programming language we showed how to implement it using for loop. Now the following code implements this summation equation using while loop.

N = 5

x = 0

k = 0

while k != N+1:

x += 2*k

k = k+1

print(x)

The result is 30

For book see Download An Introduction to Python and Computer Programming PDF free.

## No Comment to " Calculating Summation using While Looop in Python programming language "