The Python lower function is a Python String function that converts the given string into Lowercase letters and returns a new string. Let us see how to convert a string to lowercase using lower Function in Python Programming with example.
The syntax of the lower function in Python Programming Language for a lowercase string is
String_Value.lower()
Python lower function Example
The following set of examples help to understand how to convert a string to lowercase using the string lower function.
TIP: The string lower Function keep the Non-letters unchanged.
# Python string lower() Method Example Str1 = 'Learn PYTHON AT Tutorial GateWay' Str2 = Str1.lower() print('First Output of a Lower() method is = ', Str2) # Observe the Original String print('Converted String is = ', Str1.lower()) print('Original String is = ', Str1) # Performing lower() function directly Str3 = 'PYTHON ProGramming'.lower() print('Second Output of a Lower() method is = ', Str3) Str4 = 'PYTHON1234Tutorial'.lower() print('Third Output of a Lower() method is = ', Str4) Str5 = '12345'.lower() print('Third Output of a Lower() method is = ', Str5)
OUTPUT
ANALYSIS
The following statement converts the String variable Str1 into lowercase using the lower function, and prints the output.
Str1 = 'Learn PYTHON AT Tutorial GateWay' Str2 = Str1.lower() print('First Output of a Lower() method is = ', Str2)
The Python lower function returns the output in a new string, instead of altering the original string.
# Observe the Original String print('Converted String is = ', Str1.lower()) print('Original String is = ', Str1)
To change the original String, write the following string lower statement
Str1 = Str1.lower()
The Lowercase String function only converts the letters into lowercase and leave other values unchanged. Within the following lower statements, we used the numeric values along with letters.
Str4 = 'PYTHON1234Tutorial'.lower() print('Third Output of a Lower() method is = ', Str4) Str5 = '12345'.lower() print('Third Output of a Lower() method is = ', Str5)