DEV Community

Discussion on: Write a script to identify an anagram

Collapse
 
aspittel profile image
Ali Spittel

In Python, I've always used the builtin Counter collection!

from collections import Counter

def isAnagram(word, check_word):
    return Counter(word) == Counter(check_word)