Question: Provide Simple Python Code for the following function with comments and a screenshot of the code: Write a function named count_letters that counts the letters
Provide Simple Python Code for the following function with comments and a screenshot of the code:

Write a function named count_letters that counts the letters in its parameter named s. It returns a dictionary containing pairs in which the key is a letter and the values of a key is the number of times the letter appears in s. Sample >>> print(sorted (count_letters('brontosaurus').items())) [('a', 1), ('b', 1), ('n', 1), ('0', 2), ('r', 2), ('s', 2), ('t', 1), ('u', 2)] >>> print(sorted (count_letters('Hello world!').items()) [('', 1), ('!', 1), ('d', 1), ('e', 1), ('h', 1), ('l', 3), ('o', 2), ('r', 1), ('w', 1)]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
