Tech Study

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

Introduction

Write a Python function that accepts a string and calculate the number of upper case letters and lower case letters. I have used python 3.7 compiler for debugging purpose.

def string_test(str):
    d={"UPPER_CASE":0, "LOWER_CASE":0}
    for c in str:
        if c.isupper():
           d["UPPER_CASE"]+=1
        elif c.islower():
           d["LOWER_CASE"]+=1
        else:
           pass
    print ("Original String : ", str)
    print ("No. of Upper case characters : ", d["UPPER_CASE"])
    print ("No. of Lower case Characters : ", d["LOWER_CASE"])
 
string_test('TechStudy - The Complete Debugging Solution')

Result

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

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

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more