Advertisement
Guest User

Untitled

a guest
Feb 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. short_string = "fo r ba oo"
  2.  
  3. long_string1 = "foo bar baz"
  4. long_string2 = "soo az bn"
  5.  
  6. # match between short and long_string1
  7. match1 = ['fo', 'ba', 'oo']
  8. # same for long_string2
  9. match2 = ['oo', 'az']
  10.  
  11. # It would be better if we ignore the spaces
  12. prop_match1 = sum([len(i) for i in match1])/len(short_string)
  13. # 0.6
  14.  
  15. # same for prop_match2
  16. # outputs 0.4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement