Why weren’t my dictionary values printed?


#1

Question

Why weren’t my dictionary values printed?

Answer

There are several reasons, but some common issues are:

  1. Using parentheses instead of brackets to access a dictionary key value, like this: residents("Sloth")
  2. Not matching the capitalization and/or spelling of the key found in the dictionary, like this:
    residents["sloth"]
  3. Trying to write both at once, like this: residents["Sloth", "Burmese Python"]

FAQ: Learn Python: Python Lists and Dictionaries - This Next Part is Key