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()
The lower() method doesn't take any parameters. At the time of conversion, all symbols and letters are ignored.
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 |
# 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?
# 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.