Ad Code

Responsive Advertisement

To Count the Number of Uppercase and Lowercase in a String in Python

To Count the Number of Uppercase and Lowercase in a String in Python


Question-: Write a Program to input a string and the Program should count the number of the Uppercase and Lowercase in string in Python?


Solution-:

str = input ( " Enter the string : ")
x = len ( str )
up = 0
low = 0
for i in range (0,x,1):    
if str[i].isupper()==True:      
            up  = up + 1
str[i].islower()==True:       
            low = low + 1
print( " Number of Upper case are ",up)
print( " Number of the Lower case are ", low)


OUTPUT-:


Enter the string :  Python Hello World

Number of Upper case are  3

Number of the Lower case are  13


Process finished with exit code 0

Check more Program here

For any Query comment below