2020-01-08 13:18:17 +00:00
|
|
|
def upper(word: str) -> str:
|
2020-05-22 06:10:11 +00:00
|
|
|
"""
|
|
|
|
Will convert the entire string to uppercase letters
|
|
|
|
|
2020-01-08 13:18:17 +00:00
|
|
|
>>> upper("wow")
|
|
|
|
'WOW'
|
|
|
|
>>> upper("Hello")
|
|
|
|
'HELLO'
|
|
|
|
>>> upper("WHAT")
|
|
|
|
'WHAT'
|
|
|
|
>>> upper("wh[]32")
|
|
|
|
'WH[]32'
|
|
|
|
"""
|
|
|
|
|
|
|
|
# converting to ascii value int value and checking to see if char is a lower letter
|
2020-06-16 08:09:19 +00:00
|
|
|
# if it is a capital letter it is getting shift by 32 which makes it a capital 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()
|