Access Dictionary

PHOTO EMBED

Tue Nov 23 2021 10:06:27 GMT+0000 (UTC)

Saved by @Sourabh

# Definition of dictionary
europe = {'spain':'madrid', 'france':'paris', 'germany':'berlin', 'norway':'oslo' }

# Print out the keys in europe
print(europe.keys())

# Print out value that belongs to key 'norway'
print(europe['norway'])
content_copyCOPY

If the keys of a dictionary are chosen wisely, accessing the values in a dictionary is easy and intuitive.

https://campus.datacamp.com/courses/intermediate-python/dictionaries-pandas?ex=4