Python string lower() method
Return the string in lower case.
Syntax
str.lower()
Use it to compare text without caring about capitals: answer.lower() == "yes". Strings cannot change, so this returns a new string; keep it with s = s.lower(…).
Parameters
None.
Return value
str
Example
Code
print("Hello WORLD".lower()) answer = " YES " print(answer.strip().lower() == "yes")
Output
hello world True
Related
Learn it step by step in the free lesson Strings, with exercises that check your answers.