 In order to do the assignment, you'll need one more function that isn't covered in the book. And it's not in the book because it involves lists, which are in the next chapter. But you're all pretty sharp people, so I know you can handle this. Just consider it as a preview of coming attractions. The function we're going to investigate is called split. Let's say we have this variable, phone equals 408-555-1212. If I wanted to get the area code prefix and number as three separate strings, I could do something like this, phone.find of dash, to find where the first dash was and then use slices to separate the string into its component parts. But it's much easier for me to say this. Parts equals phone.split and tell it the character or characters that I want to use for splitting. If I now print parts, you'll see I have a list in square brackets of three strings, 408-555-1212. I can then assign those to individual variables. I can say area code equals parts 0, prefix equals parts 1, and number equals parts 2. And then print area code, prefix, and number individually. If you don't give an argument to split, it divides the string on white space, blanks, tabs, and new lines. If I set my sentence to be 4 score and 7 years, and then say word list equals sentence.split with no argument in the parentheses, if I look at the word list, it's split up into the words exactly as I wanted. I can now use a for loop to go through the list as well, just as you saw in chapter 4 when we introduced the for loop. I can say for word in word list, print word, and that'll print each word on a line all by itself. Knowing this, we can write a program that goes through a sentence and builds a new sense with each word reversed. So the string, for example, would come out as Roff Maxi. That's the program we want to write. A bit useless, but it gets the point across. Let's put the comments in here to tell what the program does, accepts a sentence, and then prints it with each word in the sentence reversed. First, we're going to need a function to reverse a string. Let's define reverse with s as the parameter. We're going to need a new string as the result, which starts as the empty string. And then for each character in the string s, we're going to say the new version value of result is equal to the character we have plus the old value of result. This adds the characters at the beginning of the string, not at the end. And we return result. Let's save that, run it, and then we can test it here in the shell. If I say reverse, example, works like a champ. Now the main program, which prompts for input, splits it into words and calls reverse for each word and creates a brand new string with the backwards or semi-backwards sentence. We're going to define main to say that sentence is input of enter a sentence. We'll get our word list by splitting the sentence on white space. And we're going to need a string for our result, let's call it backwards, and again it starts off as the empty string. For each word in the word list, we're going to set backwards equal to its previous value plus whatever we get from reversing the individual word, plus a blank. This extra blank is to separate the words when we build our output. When we're done with all the words, we'll say backwards equals backwards.strip to get rid of that last blank at the end, and then print the result. Let's save, clear the shell, and run. And it's not doing anything because guess what? I forgot to invoke main. This is a common error, so don't feel bad if you did it. I do it too. Let's run that again. And the sentence will be useless but instructive program. And there it is with each word reversed. So that's how you can use split to split a string into a list of substrings and then process them one at a time.