Home > Articles

  • Print
  • + Share This
This chapter is from the book

Common Student Questions

  • What is the difference between a list and a dictionary? A list is for an ordered list of items. A dictionary (or dict) is for matching some items (called “keys”) to other items (called “values”).

  • What would I use a dictionary for? When you have to take one value and “look up” another value. In fact, you could call dictionaries “look up tables.”

  • What would I use a list for? Use a list for any sequence of things that needs to be in order, and you only need to look them up by a numeric index.

  • What if I need a dictionary, but I need it to be in order? Take a look at the collections.OrderedDict data structure in Python. Search for it online to find the documentation.

  • + Share This
  • 🔖 Save To Your Account