Question: def count _ letters ( text ) : # Initialize a new dictionary. dictionary = _ _ _ # Complete the for loop to iterate
def countletterstext:
# Initialize a new dictionary.
dictionary
# Complete the for loop to iterate through each "text" character and
# use a string method to ensure all letters are lowercase.
for
# Complete the ifstatement using a string method to check if the
# character is a letter.
if
# Complete the ifstatement using a logical operator to check if
# the letter is not already in the dictionary.
if
# Use a dictionary operation to add the letter as a key
# and set the initial count value to zero.
# Use a dictionary operation to increment the letter count value
# for the existing key.
# Increment the letter counter.
return dictionary
printcountlettersAaBbCc
# Should be a: b: c:
printcountlettersMath is fun!
# Should be m: a: t: h: i: s: f: u: n:
printcountlettersThis is a sentence."
# Should be t: h: i: s: a: e: n: c:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
