To perform useful calculations on the contents of a dictionary, it is often useful to invert the keys and values of the dictionary using zip(), which creates an iterable tuple of a dictionary’s keys and values.

prices = {
  "ACME": 45.23,
  "AAPL": 612.78,
  "IBM": 205.55,
  "HPQ": 37.20
}

prices
## {'ACME': 45.23, 'AAPL': 612.78, 'IBM': 205.55, 'HPQ': 37.2}
zipped = zip(prices.values(), prices.keys())
for v, k in zipped:
  print(v, k)
## 45.23 ACME
## 612.78 AAPL
## 205.55 IBM
## 37.2 HPQ

The zip() function returns an iterator. Trying to perform operations on it directly leads to ValueError: min() arg is an empty sequence. Instead, you need to explicitly declare the items.

min(zip(prices.values(), prices.keys()))
## (37.2, 'HPQ')