Yandex

Python String islower() Method – Check for Lowercase Strings


Python String islower() Method

The islower() method in Python checks whether all the alphabetic characters in a string are lowercase. It’s a simple and useful method when working with string validation or formatting rules.

Syntax

string.islower()

Parameters:

  • No parameters — it is called on a string.

Returns:

  • True if all cased characters are lowercase and there is at least one cased character
  • False otherwise

Example 1: Basic Usage

text = "hello world"
print(text.islower())
True

Example 2: Contains Uppercase

text = "Hello World"
print(text.islower())
False

Example 3: No Alphabetic Characters

text = "12345!@#"
print(text.islower())
False

Why? Because there are no alphabetic characters, so the method returns False.

Use Cases

  • Validating form inputs (e.g., passwords or usernames in lowercase)
  • Checking if a word needs to be capitalized
  • Filtering or tagging lowercase-only messages or text

Common Mistakes

  • Thinking it returns True for strings like "1234" – but it doesn't (needs at least one alphabet character).
  • Calling it without parentheses: string.islower will return a method object, not the result.

Interview Tip

islower() is often used in string parsing or classification tasks. Pair it with isupper() and isalpha() for effective string handling.

Summary

  • islower() checks if all alphabetic characters in a string are lowercase
  • Returns True only if at least one letter exists and all are lowercase
  • Returns False for strings with uppercase letters or no alphabetic characters

Practice Problem

Write a program that takes input from the user and tells whether it is completely in lowercase:

user_input = input("Enter a string: ")
if user_input.islower():
    print("All characters are lowercase.")
else:
    print("Not all characters are lowercase.")


Welcome to ProgramGuru

Sign up to start your journey with us

Support ProgramGuru.org

You can support this website with a contribution of your choice.

When making a contribution, mention your name, and programguru.org in the message. Your name shall be displayed in the sponsors list.

PayPal

UPI

PhonePe QR

MALLIKARJUNA M