Question: Q3: Sum fun! (Loop algorithms: Sum of values) Instructions This week we will step through some common loop algorithms. To start us off, we will

Q3: Sum fun! (Loop algorithms: Sum of values)

Instructions

This week we will step through some common loop algorithms. To start us off,

we will obtain a sum of values.

Your task is to fix the code so that it does what is expected/described below.

Details

Input

The program reads in the following:

an integer values (unknown quantity, each on their own line)

followed by one empty line (empty string )

Processing

Sum of values algorithm:

Initialize total to 0

Read in a value (make sure to convert it to proper data type)

Use while loop with looking for sentinel, each time through loop:

Add entered value to total

Read in another value (make sure to convert it to proper data type)

Output

Output the sum of the values.

Sample input/output:

Input Output
3 4 5 The sum of the values is 12.

Q3: Sum fun! (Loop algorithms: Sum of values) Instructions This week we

\# Input total =0.0 inputString = input("Enter value: ) while inputString !=" value=int(inputString)inputString=input("Entervalue: )total+=valueprint(Thesumofthevaluesis+str(total)+)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!