How to use the “lower” function in Python?

In Python, the lower() function can be used to convert all characters in a string to lowercase. Here is an example:

name = "John Doe"
lower_name = name.lower()
print(lower_name)

The output result is:

john doe

In this example, the lower() function converts all characters in the string ‘name’ to lowercase letters and assigns the result to the variable ‘lower_name’. Finally, the value of lower_name is printed using the print() function.

bannerAds