Anagram Program

 Type1:

T1=(input("Enter the String1: ")).lower()
T2=(input("Enter the String2: ")).lower()  #ASCII

for i in T1:
    if i in T2:
        print("Letter",i,"Present")
    else:
        print("Not an Anagram")

Output:


Type2:

T1=(input("Enter the String1: ")).lower()
T2=(input("Enter the String2: ")).lower()  #ASCII

#Sorted a Character       
if sorted(T1)==sorted(T2):
    print(sorted(T1))        #List
    T=sorted(T1)
    print("|".join(T))  
    print("The words are Anagram")
else:
    print("They are not Anagram")

Output:



If you have any doubts, feel free to post it in comment Section.

Comments

Popular posts from this blog

Guessing the Number Game

Find the final amount after Discount

Simple Arithmetic Calculator - User Defined Function