Learn
Using Dictionaries
Get A Key

Once you have a dictionary, you can access the values in it by providing the key. For example, let’s imagine we have a dictionary that maps buildings to their heights, in meters:

building_heights = {"Burj Khalifa": 828, "Shanghai Tower": 632, "Abraj Al Bait": 601, "Ping An": 599, "Lotte World Tower": 554.5, "One World Trade": 541.3}

Then we can access the data in it like this:

>>> building_heights["Burj Khalifa"] 828 >>> building_heights["Ping An"] 599

Instructions

1.

We have provided a dictionary that maps the elements of astrology to the zodiac signs. Print out the list of zodiac signs associated with the "earth" element.

2.

Print out the list of the "fire" signs.

Folder Icon

Sign up to start coding

Already have an account?