Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE CODE IN PYTHON Write a recursive function count upper lower() that takes a non-empty string as its argument and returns a tuple containing the

PLEASE CODE IN PYTHON

Write a recursive function count upper lower() that takes a non-empty string as its argument and returns a tuple containing the counts of how many letters in the string are uppercase and how many are lowercase (in that order). To solve this problem you will need to write a function that returns a pair of values (i.e., a tuple). For example, suppose we wanted to write a function that returned the sum and product of two values passed as arguments to the function. We might write this code: def sum_prod(a, b): return a+b, a*b Here is an example of how we might call the function and access the return values. s, p = sum_prod(3, 6) print(s,p) In this example, the two return values will be assigned to s and p accordingly based on their position in the tuple. In other words, a+b will be assigned to s, and a*b will be assigned to p.

Examples:

Function Call : Return Value

count upper lower(Stony Brook University) (3, 17)

count upper lower(HAPPINESS) (9, 0)

count upper lower(no more labs, yay!) (0, 13)

count upper lower(&@*:!@88??) (0, 0)

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

=+ 9. What is inflation and what causes it?

Answered: 1 week ago

Question

=+6. What does the invisible hand of the marketplace do?

Answered: 1 week ago