Python program to check if lowercase letters exist in a string

23 Jun, 2022
Given a String, the task is to write a Python program to check if the string has lowercase letters or not.
Examples:
Input: "Live life to the fullest"
Output: true

Input: "LIVE LIFE TO THe FULLEST"
Output: true

Input: "LIVE LIFE TO THE FULLEST"
Output: false
Methods 1#: Using islower()
It Returns true if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.
Python
# Python code to demonstrate working of# is.lower()  method in strings #Take any stringstr = "Live life to the Fullest" # Traversing Each character of# the string to check whether# it is in lowercasefor char in str:    k = char.islower()     if k == True:        print('True')             # Break the Loop when you    # get any lowercase character.        break  # Default condition if the string# does not have any lowercase character.if(k != 1):    print('False')
Output:
True
Methods 2#: Using isupper()
It Returns true if all cased characters in the string are uppercase and there is at least one cased character, false otherwise.
Python
# Python Program to demonstrate the# is.upper() method in strings#Take a stringstr = "GEEKS" # Traversing Each character# to check whether it is in uppercasefor char in str:    k = char.isupper()     if k == False:        print('False')                 # Break the Loop        # when you get any        # uppercase character.        break # Default condition if the string# does not have any uppercase character.if(k == 1):    print('True')
Output:
True
Methods 3#: Using ASCII Value to check whether a given character is in uppercase or lowercase.
The ord() function returns an integer representing the Unicode character.
Example:  
print(ord('A'))    # 65
print(ord('a'))    # 97
Python3
# Python Program to Demonstrate the strings# methods to check whether given Character# is in uppercase or lowercase with the help# of ASCII values #Input by geeksx = "GEeK" # countercounter = 0 for char in x:    if(ord(char) >= 65 and ord(char) <= 90):               counter = counter + 1             # Check for the condition    # if the ASCII value is Between 97 and 122    # if condition is True print the    # corresponding result    if(ord(char) >= 97 and ord(char) <= 122):        print("Lower Character found")        breakif counter == len(x):    print(True)
Output:
Lower Character found
Method#4: Using re.search() re.search module is used to search for the pattern in string. We can use the lower case as a patter to search in string. 
Python3
# Python code to find the existence of# lower case in string# importing re moduleimport re #Take any stringstr1 = "Live life to the Fullest" # Searching lower case char in string using re.searchk = re.search('[a-z]',str1)         # Default condition if search does not find# any lower case# else have lower case in stringif(k is None):    print('False')else:    print('True')
Output:
True
satyam00so
Python string-programs
Technical Scripter 2020
Python
Python Programs
Technical Scripter
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
How to Install PIP on Windows ?
Python Classes and Objects
Python OOPs Concepts
Introduction To PYTHON
How to drop one or multiple columns in Pandas Dataframe
Defaultdict in Python
Python | Get dictionary keys as a list
Python | Convert a list to dictionary
Python Program for Fibonacci numbers
Python | Convert string dictionary to dictionary