Write a Python program to count number of lowercase characters in a string take input from the user

Use the Input method to take a string from the user. Then user for-loop and check every character lowercase or not.

Python program to count the number of lowercase characters in a string Example

Simple example code to count the number of lowercase characters in a string.

The for loop is used to traverse through the characters in the string.

string = input("Enter string: ")
count = 0
for i in string:
    if i.islower():
        count = count + 1
        
print("Count: ", count)

Output:

Python program to count the number of lowercase characters in a string Example

Do comment if you have any doubts and suggestions on this Python char count program.

Note: IDE: PyCharm 2021.1.3 (Community Edition)

Windows 10

Python 3.7

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.