When you call raw_input(), you get a string like: 'foo bar baz quux'. This contains several words.
The .split() function of a string gives you a list of the words in the string.
>>> 'foo bar baz quux'.split()['foo', 'bar', 'baz', 'quux']
A list comprehension lets us apply some transformation to each element of a list. We set up a temporary "index" variable, and express some function of that variable, and the function gets evaluated with each element of the list (i.e., the index assumes each value in the list.
>>> [x * 2 for x in ['foo', 'bar', 'baz', 'quux']]['foofoo', 'barbar', 'bazbaz', 'quuxquux']
Of course, anywhere we could just write a value like that, we could write a more complicated expression instead (assuming there are no side effects, such as printing):
>>> [x * 2 for x in 'foo bar baz quux'.split()]['foofoo', 'barbar', 'bazbaz', 'quuxquux']
And of course we could just take the words from raw_input() directly - there is no need to assign them to a temporary variable first:
>>> [x * 2 for x in raw_input().split()]foo bar baz quux['foofoo', 'barbar', 'bazbaz', 'quuxquux']
The .join() of a string accepts a list: the string inserts itself between elements of the list, and returns the result of stringing all of that together.
>>> ','.join(['foo', 'bar', 'baz', 'quux'])'foo,bar,baz,quux'
The 'def' keyword allows us to define our own functions, which lets us do more complicated transformations on our index when we use the list comprehension.
>>> def double_everything_except_quux(x):... if x == 'quux': return x... else: return x * 2...>>> [double_everything_except_quux(y) for y in 'foo bar baz quux'.split()]['foofoo', 'barbar', 'bazbaz', 'quux']
Notice that there is nothing special about the variable name 'x' or 'y', and they don't even need to match: the 'y' in our list comprehension is known as 'x' within the function.
You now know everything you need. Make a pigify() function that changes a single word, and use the above techniques to create the pigified sentence. Think about what string you will want to use for .join()ing. Notice that, again, you can use expressions where you would use values, so in particular, you can feed the list comprehension directly to .join() - it's just like providing the list that is "comprehended".