Skip to content

Instantly share code, notes, and snippets.

@arossouw
Last active November 4, 2015 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arossouw/b8fa9481c4dcbe4bab1f to your computer and use it in GitHub Desktop.
Save arossouw/b8fa9481c4dcbe4bab1f to your computer and use it in GitHub Desktop.
def is_anagram(word, anagram):
return len(list(word)) == len([char for char in list(word) if char in list(anagram)])
>>> s = "Orchestra"
>>> b = "Carthorse"
>>> [char for char in list(s) if char.lower() in b.lower()]
['O', 'r', 'c', 'h', 'e', 's', 't', 'r', 'a']
>>> b = ['Carthorse']
>>> [char for char in list(s) if char.lower() in "".join(b).lower()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment