[Solved]-Python 3 Complete Function Charfrequency Charlist Accept List Characters Use Dictionary St Q37271392
In python 3,
Complete the function charFrequency(charList) that will accept alist of characters, and use a dictionary to store each character’sfrequency. Return the dictionary.
Suggested steps:
· Create an empty dictionary and initialize the char countvalues to 0 using the characters of the list of characters askeys.
· Traverse the list of characters and update the count for eachcharacter.
· Return the dictionary
Example1:
charFrequency( ‘aaaabbbbbccdddeehhhh’ )
Returned dictionary: {‘a’: 4, ‘b’: 5, ‘c’: 2, ‘d’: 3, ‘e’: 2,’h’: 4}
Example2:
charFrequency( ‘PythonRocks’ )
Returned dictionary: {‘P’: 1, ‘y’: 1, ‘t’: 1, ‘h’: 1, ‘o’: 2,’n’: 1, ‘R’: 1, ‘c’: 1, ‘k’: 1, ‘s’: 1}
Expert Answer
Answer to In python 3, Complete the function charFrequency(charList) that will accept a list of characters, and use a dictionary t… . . .
OR

