re: Write a script to identify an anagram VIEW POST

VIEW FULL DISCUSSION
 
 

While this happens to work for stressed and desserts this only checks for words which are reverse copies of each other, not anagrams.

add and dad are anagrams (same letters) but this check does not catch it:

>>> def isAnagram(a, b):   
...     return a == b[::-1]
...                        
>>> isAnagram("dad", "add")
False                      
code of conduct - report abuse