Wednesday, 15 June 2011

Counting the number of capital letters in an input?- in python -



Counting the number of capital letters in an input?- in python -

on python how create programme asks input , programme works out number of capital letters in input , output number of capital letters?

loop through string , utilize .isupper() check if letter uppercase , increment count. print count.

inpt = raw_input('enter something: ') c = 0 in inpt: if i.isupper(): c += 1 print "no. of uppercase letters: ", c

python-3.x

No comments:

Post a Comment