Thursday, March 17, 2016

Count Capital and Small Letters in Python

A program that I wrote using Python that will ask the user to give a word and then our program will count how many upper case and lower case letters can be found in the give word by the user. The code is very short and easy to understand.

If you have some questions please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing


print("");
print("Count Capital and Small Letters in a Word");
print("");
word = input("Kindly give a word : ")

print("No. of Capital Letters: ", sum(1 for a in word if a.isupper()))
print("No. of Lower Letters: ", sum(1 for a in word if a.islower()))
print("");
print("End of Program")
print("");

No comments:

Post a Comment