Question: python code Suppose you have a function that is given a string and a letter, and returns the number of times the letter occurs in

 python code Suppose you have a function that is given a

python code

Suppose you have a function that is given a string and a letter, and returns the number of times the letter occurs in the string: def countchar(str, ch): return count Write a new function called allwords that takes a list of strings as parameters, and returns a list containing number of times the given character appears in each of the words. For example, the following function call: allwords (['abracadabra', 'magic', 'wand', 'mystery'), 'a') would return the list: [5, 1, 1, 0] because the letter 'a' appears 5 times in 'abracadabra', 1 time in 'magic' and 'wand' and 0 times in 'mystery! NOTE: You are not asked to write the countchar function. The function you write should CALL the countchar function to do its job

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 Databases Questions!