Introduction
Dictionary basics
Dictionaries in loops and conditional statements
9. Iterating over dictionary elements – values()
Dictionaries in functions
Summary

Instruction

Perfect! If you don't need to look at the keys and just want all values, you can use the values() function; this returns a list of all values in the dictionary. If a value appears twice in a dictionary, under two different keys, it'll appear twice in the list returned by values().

daily_earnings = {'Day 1': 23.04, 'Day 2': 17.89, 'Day 3': 13.54}
total_sum = 0.0

for value in daily_earnings.values():
  total_sum = total_sum + value

print(total_sum)

The code above will iterate over all values present in the daily_earnings dictionary and add them.

Exercise

Write some Python code that will take all values from os_releases and create a new dictionary that uses these values as its keys: the os_lengths. In turn, the values in the new dictionary should be the integer lengths of the keys. For instance: {2013: 'Windows 10'} should be turned into {'Windows 8.1': 11}, as the length of 'Windows 8.1' is 11.

Stuck? Here's a hint!

Use len(x) to get the length of x.