Question: Python Coding Assignment (You can use while, if, elif, else, but do NOT use break. Keep it SIMPLE and as few lines as possible) We

Python Coding Assignment

(You can use while, if, elif, else, but do NOT use "break". Keep it SIMPLE and as few lines as possible)

We like to process items that a user wishes to purchase.

a) We like to be able to have the user enter prices for as many items that she wants to purchase. Allow for a sentinel value to end the input loop. You may pick a negative number as the sentinel value.

b) Do not allow the user to enter an invalid price (a price greater than $200). Issue an error message and allow the user to enter a valid price.

c) Calculate and display the total amount of all purchases and the number of items purchased.

d) Calculate and display the average price of all purchases.

e) Calculate and display the lowest price of all purchases. (see NOTE, after the sample interactions for pseudocode and explanation for finding the lowest value)

f) Calculate and display the highest price of all purchases.

g) If the user enters the sentinel value at the beginning of the processing, the code should display a message such as There is nothing to process!

Sample Interaction:

Welcome to Bargain Basement

Where bargains are our business!

Please enter the item price. Type -1 when finished: 100

Please enter the item price. Type -1 when finished: 1000

Invalid price!

Our items are priced $200 or less. Try again.

What is the price per item? $ 50

Please enter the item price. Type -1 when finished: -1

Total number of items: 2

Total Price: $150.00

Average Price: $75.00

The lowest priced item was: $50.00

The highest priced item was: $100.00

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!