Skip to content

Instantly share code, notes, and snippets.

@mutaku
Created March 29, 2016 18:17
Show Gist options
  • Save mutaku/174a38c4f7a2a69c011ce6fcadf321dd to your computer and use it in GitHub Desktop.
Save mutaku/174a38c4f7a2a69c011ce6fcadf321dd to your computer and use it in GitHub Desktop.
anagramamama
# ver a
def anagram(str_a, str_b):
return sorted([ord(x) for x in str_a]) == sorted([ord(y) for y in str_b])
# ver b
def anagram(str_a, str_b):
if len(str_a) == len(str_b):
return sorted(str_a) == sorted(str_b)
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment