0

I am executing a code with SequenceMatcher (Difflib library) nested in an "IF" Statement like this:

'''

from difflib import SequenceMatcher

string_one = 'He is right'
string_two = 'He was right'

print("It returns a ratio", SequenceMatcher(a=string_one,b=string_two).ratio())
if(SequenceMatcher(a=string_one,b=string_two).ratio()>=60):
    print("It does not return a ratio", SequenceMatcher(a=string_one,b=string_two).ratio())

'''

The first Sequence Matcher (Before the If statement) returns a ratio, but the second one (Inside the "If" Statement) does not return a ratio.

Can any

0 Answers0