Advertisement
xm4dn355x

two words check

Feb 3rd, 2023 (edited)
746
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | Source Code | 0 0
  1. words_pairs = [
  2.     ['gameftgh', 'game'],
  3.     ['forgameng', 'forge'],
  4.     ['gaming', 'gaming']
  5. ]
  6.  
  7. def exercise(case: str, checker: str) -> bool:
  8.     for check in checker:
  9.         if check in case:
  10.             case = case.replace(check, '', 1)
  11.         else:
  12.             return 'NO'
  13.     if case:
  14.         return 'YES'
  15.     else:
  16.         return 'NO'
  17.  
  18. for pair in words_pairs:
  19.     print(pair)
  20.     print(exercise(pair[0], pair[1]))
  21.  
Tags: test
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement