Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import Counter
- def detect_anagrams(word, candidates):
- return [c for c in candidates if is_anagram(word, c)]
- def is_anagram(a, b):
- a, b = a.upper(), b.upper()
- return Counter(a) == Counter(b) and a != b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement