How to make all the letters with lowercase in Python
Learn how to convert any string to lowercase in Python with an easy-to-follow example.
Changing All Letters to Lowercase in Python
Using the Python programming language, it is possible to change all the characters in a string to lowercase easily. The lower() method can be used to achieve this.
# example of a string
string_ex = "This Is An EXAMPLE"
# using the lower() method
string_ex = string_ex.lower()
# the output
print(string_ex)
# this is an example
The lower() method can also be used with a variable containing a string. For example, if there is a variable called string_var containing a string, then the following line of code can be used to change the characters in the string to lowercase:
# example of a variable containing a string
string_var = "This Is Another EXAMPLE"
# using the lower() method
string_var = string_var.lower()
# the output
print(string_var)
# this is another example
In summary, the lower() method in Python can be used to change all the characters in a string to lowercase easily.
p