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
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)
Comments
Leave a comment