Computer Science, asked by anushka070603, 4 months ago

python program
________________
write a program to check whether two strings are anagram or not
_________________
warning:
don't spam
________________

Answers

Answered by IIAstuteIshII
3

ɧɛƖƖơ ɱąɬɛ

Answer:

def is_anagram(s1,s2):

   l1=sorted(s1)

   l2=sorted(s2)

   if len(l1)!=len(l2):

       print("they are not anagrams")

   else:

       if l1==l2:

           print("they are anagrams")

       else:

           print("they are not anagrams")

#  MAIN

S1=str(input("enter the first word"))

S2=str(input("enter the second word"))

is_anagram(S1,S2)

________________________

ɴᴏᴛᴇ:

  • ᴘʟᴇᴀsᴇ ᴄʜᴇᴄᴋ ᴛʜᴇ ᴀᴛᴛᴀᴄʜᴍᴇɴᴛ Fᴏʀ ᴘʀᴏᴘᴇʀ ɪɴᴅᴇɴᴛᴀᴛɪᴏɴ

________________________

Explanation:

Qᴜᴇsᴛɪᴏɴ:

ᴡʜᴀᴛ ᴀʀᴇ ᴀɴᴀɢʀᴀᴍs ??

ᴀɴsᴡᴇʀ:

ᴀɴᴀɢʀᴀᴍs ᴀʀᴇ ᴡᴏʀᴅs ᴏʀ ᴘʜʀᴀsᴇs ʏᴏᴜ sᴘᴇʟʟ ʙʏ ʀᴇᴀʀʀᴀɴɢɪɴɢ ᴛʜᴇ ʟᴇᴛᴛᴇʀs ᴏF ᴀɴᴏᴛʜᴇʀ ᴡᴏʀᴅ ᴏʀ ᴘʜʀᴀsᴇ.

sᴏᴍᴇ ᴇxᴀᴍᴘʟᴇs ᴏF ᴀɴᴀɢʀᴀᴍs ᴀʀᴇ:

ʟɪsᴛᴇɴ = sɪʟᴇɴᴛ

ᴀsᴛʀᴏɴᴏᴍᴇʀ = ᴍᴏᴏɴ sᴛᴀʀᴇʀ

ᴛʜᴇ ᴇʏᴇs = ᴛʜᴇʏ sᴇᴇ.

ᴀ ɢᴇɴᴛʟᴇᴍᴀɴ = ᴇʟᴇɢᴀɴᴛ ᴍᴀɴ

________________________

ɧơ℘ɛ ıɬ ɧɛƖ℘ʂ ყơų  ☺

Attachments:
Similar questions