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!

[IP068] Price Diversity

Tina Belcher, the eldest Belcher sibling, is analyzing the restaurant's menu to understand its pricing diversity. She wants to gather a unique set of all the different prices on the menu. The menu is represented as a dictionary where the keys are item names, and the values are their corresponding prices. Tina needs a collection that contains every unique price listed on the menu, with no duplicates.

The Problem

Write a function price_diversity(menu) that given a dictionary menu with string keys representing menu items and integer values representing prices, returns a set of the different prices (with no duplicates).

Constraints

The following limits are guaranteed in all the test cases that will be given to your program:

1 ≤ |menu| ≤ 100       number of items in the menu

Example Function Calls Example Output
menu = {"donut":100, "burger":400, "soda":150, "pizza":400, "juice":150}
prices = price_diversity(menu)
print(type(prices))
print(sorted(list(prices)))
<class 'set'>
[100, 150, 400]

Introduction to Programming (CC1024)
DCC/FCUP - University of Porto