Python String lower() method
Python String lower() method
The string.lower() method in Python returns a string where all characters are lower case.
Syntax
string.lower()
Parameter
NA
Return
This method returns a string where all characters are lower case.
Example 1
# Python program explaining # the string.lower() method # initializing the string string = "HELLO WORLD" print("String:",string) # converting the string to lower case lowStr = string.lower() print("After converting it in lower case:") # printing the string print("String:",lowStr)
Output
String: HELLO WORLD After converting it in lower case: String: hello world
Example 2
# Python program explaining # the string.lower() method # initializing the string String1 = "PYTHON IS AN EASY PROGRAMMING LANGUAGE" # second string String2 = "PYTHON iS AN EasY PROGRAMMING LanguaGE" if(String1.lower() == String2.lower()): print("Both the strings are the same.") else: print("Both the strings are not the same.")
Output
Both the strings are the same.