How will you convert a string to all lowercase?

Hi, How will you convert a string to all lowercase

Jhon asked:

“Hi, How will you convert a string to all lowercase”

>>> s = "Hello World!"
>>> print(''.join(chr(ord(c)+32) if 'A' <= c <= 'Z' else c for c in s))
hello world!
2 Likes