the other part of the question which is not yet solved says: The first few rounds of output should look like: Give me a number: 7 New Value: 1, Current Sum: 1 New Value: 3, Current Sum: 4 New Value: 6, Current Sum: 10 New Value: 10, Current Sum: 20 etc. . . I need the answer for this part. please use python.
so i got this question solved before.. but a part of the question is still not complete.
The part of the question which is solved:
Ask the user for an integer, n, and perform the following summation using a while loop. During each loop iteration, display the value computed during this iteration as well as the running total of the sum. When the loop is finished, output the total sum.
The code:
n=int(input('Give me a number: '))
i=1
sum=0
while i<=n:
sum=sum+(i*(i+1))/2
i+=1
sum=int(sum)
print(sum)
the other part of the question which is not yet solved says:
The first few rounds of output should look like:
Give me a number: 7
New Value: 1, Current Sum: 1
New Value: 3, Current Sum: 4
New Value: 6, Current Sum: 10
New Value: 10, Current Sum: 20 etc. . .
I need the answer for this part.
please use python.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images