Created
May 24, 2021 08:45
-
-
Save vrat28/ab594c333b3e4a51f14a4eac43b804b6 to your computer and use it in GitHub Desktop.
To Lower case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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