Skip to content

Latest commit

 

History

History
28 lines (21 loc) · 614 Bytes

README.md

File metadata and controls

28 lines (21 loc) · 614 Bytes
  1. Write a function that takes as input (sentence: String, n: Number) and returns a list of size n where each element contains a word and and the frequency of that word in sentence This list should be sorted by decreasing frequency and alphabetical order in case of tie.

Example: Input: ("bar baz foo foo zblah zblah zblah baz toto bar", 3) Output: [ ("zblah", 3), ("bar", 2), ("baz", 2), ]

  1. Write tests for the function you just wrote

Requirements

To run the tests, you need to install pytest like so :

pip install pytest

and then run the tests using the command :

pytest