Python program to count upper and lower case characters without using inbuilt functions
Given a string that contains both upper and lower case characters in it. The task is to count number of upper and lower case characters in it without using in-built functions.
Counting the upper and lower case characters of a string can be easily done using
islower() functions, refer this. But doing the same without help of any inbuilt function is quite exciting. Let’s see how this can be done :
Input : Introduction to Python Output : Lower Case characters : 18 Upper case characters : 2 Input : Welcome to GeeksforGeeks Output : Lower Case characters : 19 Upper case characters: 3
Below is the implementation of above idea :
Lower case characters = 27 Upper case characters = 3
Lower case characters: 8 Upper case characters: 3
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course