WAP to accept string and find the count of lower and uppercase alphabets


#1

Please leave the following link in the post so we can find the unit module, else replace it with a link to the exact lesson:

Strings and Console Output


#2
def count_upper(string):
    return len([x for x in string if x.isupper()])
def count_lower(string):
    return len([x for x in string if x.islower()])
print (count_upper("The rain in Spain falls mains in the plains."))
# 2
print (count_lower("The rain in Spain falls mains in the plains."))
# 33

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.