In Python, strings have built-in methods to change their case:
s.upper() # converts all characters to uppercase
s.lower() # converts all characters to lowercase
Here are some examples:
word = "Hello World"
print(word.upper()) # "HELLO WORLD"
print(word.lower()) # "hello world"
name = "ALICE"
print(name.lower()) # "alice"
These methods return a new string — the original is not modified.
Assignment
Follow the Coding Tutorial and convert word to both uppercase and lowercase!
Hint
Use word.upper() and word.lower().
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
