In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 30th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #07 exercise sheet]
In this problem you should submit a function as described. Inside the function do not print anything that was not asked!
Bob Belcher, the owner of Bob's Burgers, wants to update the prices of his menu items to keep up with rising costs. He has a dictionary where the keys represent menu items and the values represent their current prices. Bob decides to increase the price of each menu item by a fixed increase value to ensure his business remains profitable.
Write a function update_prices(menu, k) that given a dictionary menu with string keys representing menu items and integer values representing prices, increases all values on the dictionary by k.
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ |menu| ≤ 100 | number of items on the menu | |
1 ≤ k ≤ 1000 | price increase |
Example Function Calls | Example Output |
menu = {"coffee":60, "croissant":120, "donut":100, "burger":400} update_price(menu, 10) print(sorted(list(menu.items()))) update_price(menu, 20) print(sorted(list(menu.items()))) |
[('burger', 410), ('coffee', 70), ('croissant', 130), ('donut', 110)] [('burger', 430), ('coffee', 90), ('croissant', 150), ('donut', 130)] |