top of page

Python Programming Help

Public·2 members

Python Program to count the uppercase letter and lowercase letter in string - Codersarts

To count letter in python string, we will use two python function


  • isupper()

  • islower()


Let suppose the string is like that


string = "Hello Friend this is Codersarts"

Then the output string look like that:


uppercase : 3
lowercase : 24

Solution:

string = "Hello Friend this is Codersarts"
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 ("UPPER CASE", d["UPPER CASE"])
print ("LOWER CASE", d["LOWER CASE"]) 

Output:

uppercase : 3
lowercase : 24

For other top rated Codersarts python program links


For other top rated python program visit here


If you like Codersarts blog and looking for Assignment help,Project help, Programming tutors help and suggestion  you can send mail at contact@codersarts.com.


Please write your suggestion in comment section below if you find anything incorrect in this blog post 

604 Views
bottom of page