Question: Make a .py file called fruitStorage.py. The script should asks users for a fruit/vegetable and the count of those items that they have, or quit
Make a .py file called fruitStorage.py. The script should asks users for a fruit/vegetable and the count of those items that they have, or quit to quit. Until the user enters quit, store the fruit and their count in a list of tuples, of the form:
[(tomato, 5), (blueberry, 10), .]
Duplicates should add the count to the already stored count.
When the user enters quit, print a report of the users input, with the following general appearance:
Produce, Count tomato, 5 blueberry, 10 Average count per produce item: # Total # of produce: #
Where total is the sum of counts and the average is the average count of produce per produce.
Make an edit of the first .py, called fruitDictionary. Perform the same task as above, with the same output. The exact approach is up to you. In a comment in the .py file, say which of the two approaches you prefer and why.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
