Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters

 def string_test(s):

    d = {"UPPER_CASE":0,"LOWER_CASE":0}

    for c in s:

        if c.isupper():

            d["UPPER_CASE"]+=1

        elif c.islower():

            d["LOWER_CASE"]+=1

        else:

            pass

    print ("No. of Upper case characters : ", d["UPPER_CASE"])

    print ("No. of Lower case Characters : ", d["LOWER_CASE"])

    return s

s = input("Enter a String : ")

print(string_test(s)) 


#OUTPUT

'''

Enter a String : LIVERpool

No. of Upper case characters :  5

No. of Lower case Characters :  4

LIVERpool


'''


Comments