exercicio 709 resolvido com python
This commit is contained in:
19
709-to_lower_case/python/709.py
Normal file
19
709-to_lower_case/python/709.py
Normal 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
|
||||
Reference in New Issue
Block a user