Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Oracle Fusion Applications Installation And Administration

Authors: Tushar Thakker

1st Edition

1484209834, 9781484209837

More Books

Students also viewed these Databases questions

Question

What are the important considerations in target audience selection?

Answered: 1 week ago