Question: PYTHON Problem Statement In this problem, we will experiment with key - value pairs in dictionaries in the context of items in a store and

PYTHON Problem Statement
In this problem, we will experiment with key-value pairs in dictionaries in the context of items in a store and their prices.
The first line of input will be an integer N (which is greater than 2) representing how many key-value pairs are to follow.
Each key-value pair is one string line representing the name of the item (the key), and the next is a float line representing the cost of the item (the value).
The cost of the item will not exceed 100.0.Given all of the key-value pairs:
Put them into a dictionary
Remove the key,value pair of the cheapest item
Subtract 1.0 from the price of the most expensive item
Finally, print out the updated dictionary.
Hint: You may need to find min/max values manually, rather than using the builtin min() and max() functions. Additionally, when deleting values from a dictionary by key, you must delete outside of any for/while loops.
Sample Input
3 Bread 3.80 Milk 4.31 Eggs 5.0
Sample Output
{'Milk': 4.31, 'Eggs': 4.0}

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