Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
To Lower case
class Solution:
def toLowerCase(self, str: str) -> str:
is_upper = lambda x : 'A' <= x <= 'Z'
to_lower = lambda x : chr(ord(x) | 32)
return ''.join([to_lower(x) if is_upper(x) else x for x in str])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment