Advertisement
B4EVA

anagram check

May 26th, 2022
512
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Check if two words are anagrams
  2. # Example:
  3. # find_anagrams("hello", "check") --> False
  4. # find_anagrams("below", "elbow") --> True
  5.  
  6.  
  7. def find_anagram(word, anagram):
  8.  
  9.    if(sorted(word) != sorted(anagram)):
  10.  
  11.        return False
  12.  
  13.    else:
  14.  
  15.  
  16.     return True
  17.  
  18. print(find_anagram('hello', 'check'))
  19. print(find_anagram('below', 'elbow'))
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
Advertisement
RAW Paste Data Copied
Advertisement