Login
Remember
Register
Ask a Question
Checking whether the two words are anagrams or not in python
0
votes
asked
May 24, 2020
in
Python
by
SakshiSharma
Checking whether the two words are anagrams or not
#python-anagrams
#anagram-python
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
May 24, 2020
by
Robindeniel
from collections import Counter
def is_anagram(str1, str2):
return Counter(str1) == Counter(str2)
print(is_anagram('majix', 'magic'))
print(is_anagram('majix', 'xijam'))
Output:
False
True
...