Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- short_string = "fo r ba oo"
- long_string1 = "foo bar baz"
- long_string2 = "soo az bn"
- # match between short and long_string1
- match1 = ['fo', 'ba', 'oo']
- # same for long_string2
- match2 = ['oo', 'az']
- # It would be better if we ignore the spaces
- prop_match1 = sum([len(i) for i in match1])/len(short_string)
- # 0.6
- # same for prop_match2
- # outputs 0.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement