Python String lower() method
The string.lower() method in Python returns a string where all characters are lower case.
Syntax
1 2 3 |
string.lower() |
Parameter
NA
Return
This method returns a string where all characters are lower case.
Example 1
1 2 3 4 5 6 7 8 9 10 11 12 |
# 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
1 2 3 4 5 |
String: HELLO WORLD After converting it in lower case: String: hello world |
Example 2
1 2 3 4 5 6 7 8 9 10 11 12 |
# 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
1 2 3 |
Both the strings are the same. |