Files
leetcode/709-to_lower_case/python/709.py

20 lines
514 B
Python

# 709. To Lower Case
#
# Given a string s, return the string after replacing every uppercase letter
# with the same lowercase letter.
#
# s consists of printable ASCII characters
# apenas processar letras 'A-Z'
# codigo ASCII de 'A' = 65 e 'Z' = 90
def toLowerCase(s: str) -> str:
resultado: str = ""
for index in range(len(s)):
if ord(s[index]) >= 65 and ord(s[index]) <= 90:
resultado += chr(ord(s[index]) + 32)
else:
resultado += s[index]
return resultado