Python | String lower()

lower() method converts all uppercase characters in a string into lowercase characters and returns it.

Syntax :

string.lower()

Parameters :

The lower() method doesn’t take any parameters.

Returns :

returns a lowercased string of the given string

CODE 1: String with only alphabetic characters

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 program to show the
# working of lower() function
text = 'GeEks FOR geeKS'
  
print("Original String:")
print(text)
  
# lower() function to convert 
# string to lower_case
print("\nConverted String:")
print(text.lower())

chevron_right


Output :

Original String:
GeEks FOR geeKS

Converted string:
geeks for geeks

CODE 2: String with alphanumeric characters

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 program to show the
# working of lower() function
text = 'G3Ek5 F0R gE3K5'
  
print("Original String:")
print(text)
  
# lower() function to convert 
# string to lower_case
print("\nConverted String:")
print(text.lower())

chevron_right


Output :

Original String:
G3Ek5 F0R gE3K5

Converted String:
g3ek5 f0r ge3k5

Application: One of the common application of lower() method is to check if the two strings are same or not

filter_none

edit
close

play_arrow

link
brightness_4
code

# Python3 program to show the
# working of lower() function
text1 = 'GEEKS For GEEKS'
  
text2 = 'gEeKS fOR GeeKs'
  
# Comparison of strings using 
# lower() method
if(text1.lower() == text2.lower()):
    print("Strings are same")
else
    print("Strings are not same")

chevron_right


Output:

Strings are same


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.