class Solution(object):
def toLowerCase(self, str):
"""
:type str: str
:rtype: str
"""
res = []
gap = ord('a') - ord('A')
for c in str:
if ord(c) >= ord('A') and ord(c) <= ord('Z'):
res.append(chr(ord(c) + gap))
else:
res.append(c)
return ''.join(res)
# def toLowerCase(self, str):
# return str.lower()
Download To Lower Case.pyLeetcode 709 To Lower Case problem solution in python3 with explanation. This is the best place to expand your knowledge and get prepared for your next interview.
Feedback is the most important part of any website.
If you have any query, suggestion or feedback, Please feel free to contact us.