Autumn Offers - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Practice

Instruction

Great! How about a function returning a dictionary?

Exercise

Write a function named get_character_frequencies() that takes a string as input and returns a dictionary of lowercase characters as keys and the number of their occurrences as values. Ignore the case of a character.

Stuck? Here's a hint!

First, create a dictionary:

freq_dict = {}

Then iterate over characters in the text and update the values in the dictionary accordingly. To get the values in the dictionary under a given character, you can use:

freq_dict[character]

Remember to convert letters to lowercase with the lower method:

letter.lower()