In this program, we will take two strings as input and find the string similarity between two given strings
Steps to solve te program
- Take 2 strings as inputs.
- Import difflib library.
- From difflib library use SequenceMatcher to find the similarity between two strings.
- Print the output.
#Input string
str1 = "Learning is fun in Sqatools"
str2 = "Sqatools Online Learning Platform"
import difflib
result = difflib.SequenceMatcher(a=str1.lower(), b=str2.lower())
#Printing output
print(result.ratio())
Output :
0.4