Question: Mod 1 Homework: Anagrams Write a function word _ compare that takes two arguments. There are three possible return cases: Return the string Anagram if

Mod 1 Homework: Anagrams
Write a function word_compare that takes two arguments. There are three possible return cases:
Return the string Anagram if the two inputs are anagrams
Return a two-tuple (a tuple with two items) if the two inputs are words but not anagrams
Return the string Those aren't strings! if either input is not a string.
> word_compare("rat", "tar")
'Anagram'
> word_compare("hello", "goodbye")
('hello', 'goodbye')
> word_compare (22, "hello")
"Those aren't strings!"
We'll work through this problem in three parts:
Write a function in a python file
Modify that funtion to use default parameters
Import that function in a different python file
After getting this code to work, you will add a custom test case.
Part 1-
WordCompare.py
Write a function called word_compare () inside a file
WordCompare.py that behaves as above.
 Mod 1 Homework: Anagrams Write a function word_compare that takes two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!