Tutorial Study Image

Python lower()

The lower() function in python helps to return a copy of the original string in which all the uppercase characters of the string are converted into lowercase. If no uppercase letters, it will return the original string.


string.lower() 
 

lower() Parameters:

The lower() method doesn't take any parameters. At the time of conversion, all symbols and letters are ignored.

lower() Return Value

The return value is always a string. All the Unicode chars are not converted using the lower() method. Consider the German lowercase letter 'ß' which is equivalent to 'ss' it is already in lowercase, so this method would not convert it.

Input Return Value
string lowercased string

Examples of lower() method in Python

Example 1: How to convert a string to lowercase


# example string
string = "HOW ARE YOU?"
print(string.lower())

# string with numbers

string = "Hii! How Are You123?"
print(string.lower())
 

Output:


how are you?
hii! how are you123?

Example 2: How lower() is used with condition check in a program?


# first string
String1 = "ProgRammIng LanGuaGe!"

# second string
String2 = "PROGRAMMING LANGUAGE!"

if(String1.lower() == String2.lower()):
    print("The two strings are same.")
else:
    print("The two strings are not same.")
 

Output:


The two strings are same.