Question: Write a Python program with a function called listletters ( text ) whose parameter text is a string and returns a dictionary with the key

Write a Python program with a function called listletters(text) whose parameter text is a string and returns a dictionary with the key as the letter and the value as the number of times each letter appears in the text string. Note: function is case sensitive, so H and h are counted as two different letters.
Example listletters('Banana') should return:
{'B':1,'a':3,'n':2}
Example listletters('How much wood would a woodchuck chuck if a woodchuck could chuck wood?') should return:
{'H': 1,'o': 11,'w': 5,'': 12,'m': 1,'u': 7,'c': 11,'h': 5,'d': 6,'l': 2,'a': 2,'k': 4,'i': 1,'f': 1,'?'
# Write your program here
def listletters(text):
pass
print(listletters('Banana')): 1}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!