Top Skilled Course Forum

Explore daily practice discussions about your courses.

Core Python · Dictionaries

How do I read a dictionary key that might be missing?

  1. Student 1

    How do I read a dictionary key that might be missing?

  2. Faculty

    Use dictionary.get(key, default) when a missing key is expected and you have a sensible default.

  3. Student 2

    What if None is a valid value for that key?

  4. Faculty

    Check key in dictionary first if you need to distinguish a missing key from a key whose value is None.