We use Python 3.6

go back Level: Advanced (img: AV / score: 4) level Bite 23. Find words that are > 95% similar

21 out of 22 users completed this Bite ...
Will you be Pythonista #22 to crack this Bite?
Average Bite difficulty 1-10 rating: 3.75
» You can do it! 😌

Given a list of tags of our blog find the ones that have a similarity score of over 95%

Don't worry, difflib to the rescue and in particular SequenceMatcher.

Return a list of similar tag pairs (tuples):

[('cheat sheets', 'cheat sheet'), 
 ('webscraping', 'web scraping'),
 ('contextmanagers', 'contextmanager'),

See the tests for what your code should pass. Have fun and see you in the next Bite ... by the way: What's your favorite Python module?

Github login button