Answer to Question #329084 in Python for ratul

Question #329084

Write a python function that takes a string as an argument. Your task is to calculate the number

of uppercase letters and lowercase letters and print them in the function.

===================================================================

Function Call:

function_name('The quick Sand Man')

Output:

No. of Uppercase characters : 3

No. of Lowercase Characters: 12

===================================================================

Function Call:

function_name('HaRRy PotteR')

Output:

No. of Uppercase characters : 5

No. of Lowercase Characters: 6


1
Expert's answer
2022-04-16T09:02:37-0400
def count_upper_lowercase(str_obj):
    upper = 0
    lower = 0
    for symbol in str_obj:
        if symbol.isupper():
            upper += 1
        if symbol.islower():
            lower += 1
    print("No. of Uppercase characters: ", upper)
    print("No. of Lowercase Characters: ", lower)
    return 0


data = input("Please enter your text: ")
count_upper_lowercase(data)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS