Python Program to Count Number of Lowercase Characters in a String

1. Introduction

Counting the number of lowercase characters in a string is a task that can be used to assess text complexity, readability, or adherence to style guides. Python, with its powerful string methods, makes this task simple.

A lowercase character is any alphabetical character presented in lowercase form, as opposed to uppercase (capital letters). In Python, the islower() method is used to check if a character is a lowercase.

2. Program Steps

1. Define a string to analyze.

2. Initialize a count variable to zero.

3. Loop through each character in the string, checking if it is lowercase.

4. Increment the count if a lowercase character is found.

5. Display the count of lowercase characters in the string.

3. Code Program

# Define the string
input_string = "Python is Fun to Learn!"

# Initialize the lowercase character counter
lowercase_count = 0

# Loop through each character and check if it's a lowercase letter
for char in input_string:
    if char.islower():
        lowercase_count += 1

# Print the number of lowercase characters
print(f"The number of lowercase characters is: {lowercase_count}")


The number of lowercase characters is: 14


1. input_string is assigned with the text "Python is Fun to Learn!".

2. lowercase_count is our counter, starting at 0.

3. A for loop iterates over each char in input_string.

4. The if statement uses the islower() string method to check if char is a lowercase character.

5. If char.islower() evaluates to True, lowercase_count is incremented by 1.

6. Once the loop completes, lowercase_count contains the total count of lowercase characters in input_string.

7. The print statement displays the result, which indicates there are 14 lowercase characters in the given input_string.