Lesson 27. Dictionaries as maps between objects

After reading lesson 27, you’ll be able to

  • Understand what a dictionary object data type is
  • Add to, remove from, and look up objects in dictionaries
  • Understand when to use a dictionary object
  • Understand the difference between a dictionary and a list

In the previous lesson, you learned about lists as collections of data with elements at a certain position in the list. Lists are useful when you want to store one group of objects; you saw that you could store a group of names or a group of numbers. But in real life, you often have pairs of data: a word and its meaning, a word and a list of synonyms, a person and their phone number, a movie and its rating, a song and its artist, and many others. ...

Get Get Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.