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
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad