# Get Top N Frequent Words

13
Have you seen this question before?
1. Given an example paragraph string and an integer $N$, write a function n_frequent_words that returns the top $N$ frequent words in the posting and the frequencies for each word.

2. What’s the function run-time?

Example:

Input:

posting = """
Herbal sauna uses the healing properties of herbs in combination with distilled water.
The water evaporates and distributes the effect of the herbs throughout the room.
A visit to the herbal sauna can cause real miracles, especially for colds.
"""
n = 3


Output:

n_frequent_words(posting,N) = [
('the', 6),
('herbal', 2),
('sauna', 2),
]

Next question: Search Algorithm Recall
.....
Python 3.9.6