manyspikes

Challenge 3: Counting letters

Initialising environment...

Instructions

Create a function called count_letters that receives as an input a string and returns a dictionary containing the unique characters in the string as keys, and the number of times they appear in the string as values.

For instance, count_letters("letters") should return a dictionary as follows:

{ "l": 1, "e": 2, "t": 2, "r": 1, "s": 1, }