Skip to content

Instantly share code, notes, and snippets.

@ChaitanyaBaweja
Last active April 2, 2020 12:01
Show Gist options
  • Save ChaitanyaBaweja/aa161ca4611eeb99a7d000c396d37f75 to your computer and use it in GitHub Desktop.
Save ChaitanyaBaweja/aa161ca4611eeb99a7d000c396d37f75 to your computer and use it in GitHub Desktop.
from difflib import SequenceMatcher # import
# creating a SequenceMatcher object comparing two strings
check = SequenceMatcher(None, 'chinna', 'china')
# printing a similarity ratio on a scale of 0(lowest) to 1(highest)
print(check.ratio())
# Output
# 0.9090909090909091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment