2020-01-08 13:18:17 +00:00
|
|
|
def lower(word: str) -> str:
|
2020-05-22 06:10:11 +00:00
|
|
|
"""
|
|
|
|
Will convert the entire string to lowecase letters
|
|
|
|
|
2020-01-08 13:18:17 +00:00
|
|
|
>>> lower("wow")
|
|
|
|
'wow'
|
|
|
|
>>> lower("HellZo")
|
|
|
|
'hellzo'
|
|
|
|
>>> lower("WHAT")
|
|
|
|
'what'
|
|
|
|
>>> lower("wh[]32")
|
|
|
|
'wh[]32'
|
|
|
|
>>> lower("whAT")
|
|
|
|
'what'
|
|
|
|
"""
|
|
|
|
|
2020-06-16 08:09:19 +00:00
|
|
|
# converting to ascii value int value and checking to see if char is a capital
|
|
|
|
# letter if it is a capital letter it is getting shift by 32 which makes it a lower
|
|
|
|
# case letter
|
2020-09-25 17:58:40 +00:00
|
|
|
return "".join(chr(ord(char) + 32) if "A" <= char <= "Z" else char for char in word)
|
2020-01-08 13:18:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
from doctest import testmod
|
|
|
|
|
|
|
|
testmod()
|