my_string = "Hello, World!" lowercase_string = my_string.lower()
"hello, world!"
To lowercase a string in Python, you can use the lower() method. This method returns a new string with all the characters of the original string converted to lowercase.
Note that the lower() method does not modify the original string. It returns a new string with the lowercase characters. If you want to modify the original string, you can assign the result of the lower() method back to the original variable. Here is an example:my_string = "Hello, World!" my_string = my_string.lower() # this will convert the original string to lowercase
Python Mega Course: Learn Python in 60 Days, Build 20 Apps
Learn Python on Udemy completely in 60 days or less by building 20 real-world applications from web development to data science.