String methods: change text with built-in helpers
Text comes with built-in helpers. Add a dot and a helper's name after a string, and you can shout it, tidy it, or trim off extra spaces.
The big idea
A string method like .upper() is a built-in helper that gives you back a changed version of the text.
See it in code
Add a dot and a helper's name after a string. Our hero's name is stored in lowercase, and .upper() shouts it in capitals:
name = "blaze"
print(name.upper())BLAZE
One dot, one helper, and blaze came back as BLAZE.
A helper hands back a new string and leaves the first one alone. .capitalize() makes just the first letter big — but name itself doesn't change:
name = "blaze"
print(name.capitalize())
print(name)Blaze blaze
See it? .capitalize() gave Blaze, but name is still blaze. The helper makes a new word — it doesn't rewrite yours.
Now all together. .upper() shouts, .capitalize() tidies the first letter, and .strip() trims spare spaces off the ends of any text:
name = "blaze"
print(name.upper())
print(name.capitalize())
print(" hi ".strip())BLAZE Blaze hi
"blaze".upper() gave BLAZE, and .capitalize() gave Blaze. Just like the warm-up, the helper hands back a new string — your original name is still "blaze" unless you save the result.
String helpers tidy text everywhere. Make a title shout, clean up messy player input, or check if a word ends in a certain letter. Text is one of the most common things code handles, and these helpers do the heavy lifting.
Try it yourself
Try name.replace("z", "Z") to swap a letter. Then print len(name) to count the letters, and "HELLO".lower() to quiet a shout down.
The common mistake
Expecting the original to change. name.upper() does not change name — it hands back a new string. To keep the capitals, save them: loud = name.upper().
What it unlocks
String helpers build on data types, dress up f-strings, and clean up answers from input().