Skip to content

Instantly share code, notes, and snippets.

@drvinceknight
Created February 24, 2015 13:35
Show Gist options
  • Save drvinceknight/8042c1d0648d5e7f3223 to your computer and use it in GitHub Desktop.
Save drvinceknight/8042c1d0648d5e7f3223 to your computer and use it in GitHub Desktop.
import difflib
usr_input = 'Vodca'
drinks = ['Jargerbomb', 'Vodka', 'Rum and Coke']
best_match = max(drinks, key=lambda x: difflib.SequenceMatcher(None, usr_input, x).ratio())
print best_match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment