Dictionaries have some of the same operators and built-in functions that can be used with strings, lists, and tuples. For example, the in and not in operators return True or False according to whether the specified operand occurs as a key in the dictionary.
You can use the in operator together with short-circuit evaluation to avoid raising an error when trying to access a key that is not in the dictionary. The len() function returns the number of key-value pairs in a dictionary.
To learn more about dictionaries, you might want to check out Python Basics: Dictionaries.
Now that you’ve completed this course, you can test your knowledge with this quiz:
Take the Quiz: Test your knowledge with our interactive “[OLD] Using Dictionaries in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:
Ghani on Oct. 19, 2020
A very informative course; thank you so much!