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 be able to report to our players how many enemies are in their immediate vicinity - but they want the count of each enemy by its kind. Fix the count_enemies function. It accepts as input:
enemy_names: a list of strings.It should return a dictionary where: