Question: Write a program to test if the two words entered by the user is an anagram. Create functions for this program def are_anagrams() main function
Write a program to test if the two words entered by the user is an anagram. Create functions for this program
def are_anagrams()
main function for user input and use try and except statements to handle ValueError.
Program will only accept two words, anything other than two words entered by user will
show Bad Input and program will ask user to enter again.
Program ends once user enters two words and give result if they are anagrams.
Program run:
Anagram test Enter two words separated by a space : fred Bad Input Enter two words separated by a space : fred joe mary Bad Input Enter two words separated by a space : cinema iceman
The words cinema and iceman are anagrams.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
