Question: Document (100 pts) Define a function called case() that takes a string and returns one of five possible strings. If the string is empty, case()

 Document (100 pts) Define a function called case() that takes a

Document (100 pts) Define a function called case() that takes a string and returns one of five possible strings. If the string is empty, case() should return the string "empty". If the argument is entirely uppercase*, it should return the string "upper". If the argument is entirely lowercase*, it should return the string "lower". If the argument contains a mixture of uppercase and lowercase letters, it should return the string "mixed". And finally, if there is no alphabet in the argument, you can decide a message for yourself what your function should do with non-empty strings that have no cased letters (like "12345"). You should be using conditionals and some of the string methods that we've learned. So for example, case("FOOBAR") and case("F88-BAR") should all return "upper"; case("foobar") and case("fee-bar") should all return "lower"; and finally case("Foobar"), and case("Fee-bar") should both return "mixed". Write a manuscript hw_05_case.py to include the function definition. When the script is executed, it should ask the user to input a string and then use the case () function to print out the corresponding message. *Whenever we talk about strings being "entirely uppercase or lowercase, we always ignore any characters that are not letters. So both WONDERFUL and 1-DERFULI are considered to be in uppercase. This is the standard way of defining case that just about everyone uses. DF

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!