Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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()

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

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

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago