Exercise 25. Even More Practice

We’re going to do some more practice involving functions and variables to make sure you know them well. This exercise should be straightforward for you to type in, break down, and understand.

However, this exercise is a little different. You won’t be running it. Instead you will import it into Python and run the functions yourself.

ex25.py

 1    def break_words(stuff): 2        """This function will break up words for us.""" 3        words = stuff.split(' ') 4        return words 5 6    def sort_words(words): 7        """Sorts the words.""" 8        return sorted(words) 910    def print_first_word(words):11        """Prints the first word after popping it off."""12        word =

Get Learn Python 3 the Hard Way: A Very Simple Introduction to the Terrifyingly Beautiful World of Computers and Code now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.