Question: PYTHON: Given a string, str_a, return each word and the word frequency in descending order by frequency. Constraints Not case sensitive. A word does not
PYTHON:
Given a string, str_a, return each word and the word frequency in descending order by frequency.
Constraints
Not case sensitive.
A word does not contain any spaces
If a word ends with a punctuation mark, ignore it.
The order doesn't matter for words with the same frequency (therefore your answer may differ).
Examples
"Fa la la, la la la, la la la, la la la, fa la la, la la la, la la la la" -> [('la', 20), ('fa', 2)]
"lala"-> [('lala', 1)]
START with this code:
def strFrequency(str_a):
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
