The assignment is to write a program that accepts two groups of words from the user and then prints a \"True\" statement if the two are anagrams (or at least if all the lett
You could use the following code it will not count special characters nor it will count digits and will return "they are anagrams" if the total characters have occurred equally in both strings hence will tell the the strings are anagrams or not .
text = input('Enter a string: ')
text1 = input('Enter a string: ')
text,text1 = text.lower(),text1.lower()
count = 0
count1=0
for i in range(97,123):
if chr(i) in text and chr(i) in text1:
count1+=1
if text.count(chr(i)) == text1.count(chr(i)):
count +=1
if len(text) >= len(text1):
num1 = len(text)
else:
num1 = len(text1)
if count == count1:
print("they are anagrams")
else :
print("they are not anagrams")