

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Dictionaries
incomplete
2: Duplicate Keys
incomplete
3: Accessing Dictionary Values
incomplete
4: Setting Dictionary Values
incomplete
5: Updating Dictionary Values
incomplete
6: Deleting Dictionary Values
incomplete
7: Counting Practice
incomplete
8: Iterating Over a Dictionary in Python
incomplete
9: Ordered or Unordered?
incomplete
10: Quest Status
incomplete
11: Merge Dictionaries
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
If you're unsure whether a key exists in a dictionary, use the in keyword.
cars = {"ford": "f150", "toyota": "camry"}
print("ford" in cars)
# Prints: True
print("gmc" in cars)
# Prints: False
We need to report how many enemies are in our players immediate vicinity – but they want to know what those enemies are! Fix the count_enemies function. It accepts as input:
enemy_names: a list of stringsIt should return a dictionary where: