Python - Lowercase String with str.lower()

To convert all characters in a string to lowercase in Python you can use the string's lower() method.

capital = 'Colombo is the capital city of Sri Lanka'
lower = capital.lower()

print(lower)
# colombo is the capital city of sri lanka

You don't always have to assign the result of each step to a variable. Below are some more concise ways of using a string's lower() method.

capital = 'Bogotá is the capital city of Colombia'
print(capital.lower())
# bogotá is the capital city of colombia

print('Hanoi is the capital city of Vietnam'.lower())
# hanoi is the capital city of vietnam