Skip to content

Instantly share code, notes, and snippets.

@FlaviuSim
Created May 26, 2011 22:25
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 FlaviuSim/994244 to your computer and use it in GitHub Desktop.
Save FlaviuSim/994244 to your computer and use it in GitHub Desktop.
def isAnagramOf(attempt, original):
# all the same case
attempt = attempt.strip()
if len(attempt) < 1: # only actual words
return False
attempt, original = attempt.lower(), original.lower()
for character in attempt:
position = original.find(character)
if (position == -1):
return False
original = original.replace(character, '', 1)
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment