Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/anagram.py Secret

Created Mar 8, 2021
Embed
What would you like to do?
def anagram(word1, word2):
word1 = word1.lower()
word2 = word2.lower()
return sorted(word1) == sorted(word2)
print(anagram("cinema", "iceman"))
print(anagram("cool", "loco"))
print(anagram("men", "women"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment