Question: Provide a Python program that uses a while loop and prompts the user for a series of inputs. You should use a sentinel value to

Provide a Python program that uses a while loop and prompts the user for a series of inputs. You should use a sentinel value to signal when the loop should terminate. Calculate and display the sum of the user inputs.

Some examples that you might use are the following:

  • Total number of miles traveled on a road trip.
  • Total cost of groceries in a month.
  • Total number of accidents in a year.

Include comments in your code program that describe what the program does.

Step by Step Solution

3.44 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Initialize variables total 0 sentinel 1 Sentinel value to terminate the loop Promp... View full answer

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 Programming Questions!