Concept
String Methods (.lower(), .upper())
Strings come with transformation tools that return a brand-new string:
python
shout = "wake up"
print(shout.upper()) # "WAKE UP"
print(shout.title()) # "Wake Up"
# 35. String Methods (.lower(), .upper()) Strings come with transformation tools that return a brand-new string: ```python shout = "wake up" print(shout.upper()) # "WAKE UP" print(shout.title()) # "Wake Up" ``` Remember immutability: the original `shout` is completely untouched. If you don't reassign `shout = shout.upper()`, the change evaporates.
Checkpoint
If `word = "code"` and you run `word.upper()`, what does `print(word)` show?
Practice
Convert `"danger"` to all uppercase and print it.
01
Tap code blocks below to assemble
Available Blocks