def isAnagram(a, b):
return a == b[::-1]
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")
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.