Module 2 · Working with strings · Lesson 2 of 4
String methods
Strings come with a rich toolkit of methods — functions you call on the string itself with a dot: text.upper(). Because strings are immutable, none of them changes the original; each one hands back a new string.
The everyday ones: upper()/lower() change case, strip() trims whitespace from the ends, and replace(old, new) swaps text. Since each returns a string, you can chain them.
Two more that bridge strings and lists: split() breaks a string into a list of pieces (on spaces by default, or any separator you give), and join() does the reverse — gluing a list of strings back into one.
Write a function normalise(name) that trims surrounding spaces and returns the name in all lower case. So normalise(' Ada ') returns 'ada'.