Dogs

Report a typo

Look at the code below:

from collections import defaultdict

dogs = ["pomeranian", "labrador", "corgi", "corgi", "golden retriever", "corgi", "labrador"]

dogs_dict = defaultdict(int)

for dog in dogs:
    dogs_dict[dog] += 1

print(dogs_dict["corgi"])
print(dogs_dict["husky"])
print(dogs_dict["poodle"])

How many keys does the dogs_dict have as a result of this code?

Select one option from the list
___

Create a free account to access the full topic