String methods return new text instead of changing the original string.
Text is a sequence of characters. Methods such as lower(), upper(), strip(), replace(), split(), and join() help real programs clean and organize user input.
message = " Hello Python "
cleaned = message.strip().lower()
print(cleaned)
words = "Ana,Marko,Jelena".split(",")
print(words)strip() and lower() produce a new cleaned string. split() turns comma-separated text into a list of words.
hello python
['Ana', 'Marko', 'Jelena']Change one value, then explain how the resulting data changes.
Keep this in mind: Follow each data operation in order before predicting the result.
name = " ANA "
cleaned = name.strip().lower()
print(cleaned)
print(name)
words = "Ana,Marko,Jelena".split(",")
print(" | ".join(words))
# Try upper(), replace(), or different textRun the example, then change one value and observe the result.
