#return a dictionary of counts of letters in a string def countLetters(text): counts = {} for char in text: if char.isalpha(): low = char.lower() if low in counts: counts[low] = counts[low] + 1 else: counts[low] = 1 return counts #testing letter_counts = countLetters("The quick brown fox jumps over the lazy dog.") keys = list(letter_counts.keys()) keys.sort() for char in keys: print(char, letter_counts[char])