- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
Python Program to Count Number of Lowercase Characters in a String
When it is required to count the number of lowercase characters in a string, the string can be iterated over. It can be checked to see if it has lower case characters, and the counter can be incremented.
Below is the demonstration of the same −
my_string = "Hi there how are you" print("The string is :") print(my_string) my_counter=0 for i in my_string: if(i.islower()): my_counter=my_counter+1 print("The number of lowercase characters are :") print(my_counter)
The string is : Hi there how are you The number of lowercase characters are : 15
A string is defined, and is displayed on the console.
A counter is initialized to 0.
The string is iterated over.
It is checked to see if it is lower case.
If it is lower case, the counter is incremented.
This is the output that is displayed on the console.
- Related Articles
- Count Number of Lowercase Characters in a String in Python Program
- Program to count number of distinct characters of every substring of a string in Python
- Program to check string is palindrome with lowercase characters or not in Python
- Program to count number of unique palindromes we can make using string characters in Python
- Count the Number of matching characters in a pair of string in Python
- Program to count number of characters in each bracket depth in Python
- How to count the number characters in a Java string?
- Python program to count number of substring present in string
- Python program to count the number of spaces in string
- C++ Program to count number of characters to be removed to get good string
- How to count the number of repeated characters in a Golang String?
- Java program to find the percentage of uppercase, lowercase, digits and special characters in a String
- Program to count number of palindromes of size k can be formed from the given string characters in Python
- Python Program to Calculate the Number of Words and the Number of Characters Present in a String
- Python program to count number of vowels using set in a given string