Question: (Q 1)Write a function called calculate_case that takes a string as input, and calculates the number of uppercase and lowercase letters. It should also calculate

(Q 1)Write a function called calculate_case that takes a string as input, and calculates the number of uppercase and lowercase letters. It should also calculate the total number of letters overall. The function should return these in a dictionary that looks like:

{'num_uppercase': 10, ### replace this 'num_lowercase': 10 ### replace this 'num_letters': 20 ### replace this

(But where 10 is replaced by whatever the correct number is.)

Hint: The function isalpha() can be used to determine whether a given character is a letter; recall that isupper and islower calculate whether something is uppercase or lowercase.

(Q. 2) Write a function called is_palindrome that takes a str as input, and returns True or False depending on whether the input is a palindrome.

A palindrome is a word that is spelled the same forwards or backwards. For example, the words "kayak" and "refer" are both palindromes, but "table" is not.

Hint: To solve this problem, think about how you would determine if something is a palindrome.

Start with the first and last character, and ask: are they the same?

Then move to the second and second-to-last character, and ask: are they the same?

And so on.

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!