Strings have methods for common transformations:
text = " Hello World "
text.strip() # "Hello World" (remove whitespace)
text.lower() # " hello world "
text.upper() # " HELLO WORLD "
text.replace("World", "Python") # " Hello Python "
Methods don't change the original string. Strings are immutable in Python. They return a new string with the transformation applied.
name = "alice"
name.upper() # Returns "ALICE"
print(name) # Still "alice"
name = name.upper() # Now name is "ALICE"
To keep the change, assign the result back to the variable.