2025/2026 Graded A+
How are Python dictionaries different from Python lists? - Python lists
are indexed using integers and dictionaries can use strings as indexes
What is a term commonly used to describe the Python dictionary
feature in other programming languages? - Associative arrays
What would the following Python code print out?
stuff = dict()
print(stuff['candy']) - The program would fail with a traceback
notcandy
What would the following Python code print out?
stuff = dict()
print(stuff.get('candy',-1)) - -1 not The program would fail with a
traceback
(T/F) When you add items to a dictionary they remain in the order in
which you added them. - False
What is a common use of Python dictionaries in a program? -
Building a histogram counting the occurrences of various strings in a
file