You can download this code by clicking the button below.
This code is now available for download.
Calculates and returns the frequency of each letter (a to z) in the given text.
Technology Stack : collections, string
Code Type : Function
Code Difficulty : Intermediate
def a_to_z_frequency(text):
from collections import Counter
from string import ascii_lowercase
frequency = Counter(text.lower())
sorted_frequency = {char: frequency[char] for char in ascii_lowercase if char in frequency}
return sorted_frequency