Anagram function

write a function if two strings are anagrams. ( func( string1, string2) )

2 Likes

def anagram(string1,string2):
if set(string1)==set(string2):
return True
return False
s1=input(‘Enter first string:’)
s2=input(‘Enter second string:’)
anagram(s1,s2)

2 Likes

there is an issue with your code. the count of each character is neglected here. so, words like hell and heel would be considered as an anagram from your code. try to rectify it. Good attempt tho.

1 Like