def IsAnagram(string1,string2):
lenth = len(string2)
total = 0
for char in string1:
if char in string2:
total += 1
if total == lenth:
return True
return False
print(IsAnagram("amd","madd"))
def anagramCheck2(str1,str2):
# Convert string into lists
list1 = list(str1)
list2 = list(str2)
# Sort the list value
list1.sort()
list2.sort()
position = 0
matches = True
while position < len(str1) and matches:
if list1[position]==list2[position]:
position = position + 1
else:
matches = False
return matches
def isAnagram(A,B):
if sorted(A) == sorted(B):
print("Yes")
else:
print("No")
isAnagram("earth","heart") #Output: Yes
#Hope this helps:)
is_anagram = lambda x1, x2: sorted(x1) == sorted(x2)
print(is_anagram('silent','listen')) # True
print(is_anagram('elivs', 'dead')) # False