Programming Examples
Python program to input any string and count number of uppercase and lowercase letters
Write a program to input any string and count number of uppercase and lowercase letters.
Solution
s=raw_input("Enter any String")
rint s
u=0
l=0
i=0
while i<len(s):
if (s[i].islower()==True):
l+=1
if (s[i].isupper()==True):
u+=1
i+=1
print "Total upper case letters :", u
print "Total Lower case letters :", l
Output
Enter any String Python PROG
Python PROG
Total upper case letters: 5
Total Lower case letters: 5