exercicio 709 resolvido com python

This commit is contained in:
2025-02-13 11:28:28 +00:00
parent 60c52b2aaa
commit dfccc1f010

View File

@ -0,0 +1,19 @@
# 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