Kodewick
Start learning →
Starter←→0 / 80

How many kinds of bird?

#015StarterComprehensionsDicts3 min

Birdwatching in the park at the weekend, you note down every bird you see, in messy upper and lower case: "Robin" and "robin" are the same kind. Write kinds(birds) to return how many different kinds you saw. No birds means 0.

Examples
kinds(["Robin", "sparrow", "robin", "Crow"])→3
kinds([])→0
main.py
def kinds(birds):
    unique = set()
    # your code here: a set comprehension putting each name in lower case into unique
    return len(unique)
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.