Convert an entire string to ASCII uppercase letters by looking for lowercase ASCII letters and subtracting 32 from their integer representation to get the uppercase letter. >>> upper("wow") 'WOW' >>> upper("Hello") 'HELLO' >>> upper("WHAT") 'WHAT' >>> upper(
(word: str)
| 1 | def upper(word: str) -> str: |
| 2 | """ |
| 3 | Convert an entire string to ASCII uppercase letters by looking for lowercase ASCII |
| 4 | letters and subtracting 32 from their integer representation to get the uppercase |
| 5 | letter. |
| 6 | |
| 7 | >>> upper("wow") |
| 8 | 'WOW' |
| 9 | >>> upper("Hello") |
| 10 | 'HELLO' |
| 11 | >>> upper("WHAT") |
| 12 | 'WHAT' |
| 13 | >>> upper("wh[]32") |
| 14 | 'WH[]32' |
| 15 | """ |
| 16 | return "".join(chr(ord(char) - 32) if "a" <= char <= "z" else char for char in word) |
| 17 | |
| 18 | |
| 19 | if __name__ == "__main__": |
nothing calls this directly
no outgoing calls
no test coverage detected