Reading Time: 1 minutes
Anagram Test in Python
Given two strings, write a Python program for Anagram Test i.e. check if they are anagrams.
stringOne = 'William Shakespeare' stringTwo = 'I am a weakish speller' setOfCharactersInStringOne = set(sorted(stringOne.upper())) setOfCharactersInStringTwo = set(sorted(stringTwo.upper())) if orderedListOfCharactersInStringOne == orderedListOfCharactersInStringTwo: print("These are anagrams!") else: print("Not anagrams....")