HW 10

This is due Friday.

  1. Read all of Chapter 4 if you have not yet done so.

  2. Programming: Create a file psearch.py and inside write a function called psearch that returns the first word in a string that starts with the letter 'p'. If no word is found, return the constant value None. We haven't used None much before, but it just means no value.

    # This would print 'peaches'
    word = psearch("I love to eat peaches on a sunny day")
    print(word)
    
    # This would print 'people'
    x = psearch("I know people who throw pancakes")
    print(x)

    You can return None like so:

    return None

    Your only job is to write a function. Your submission should not have other runnable code. Obviously test your function with your own tests, but remove them when confident in your function. Your psearch function should take a single string argument, and then return a string result. You didn't forget your helpful string functions, right? Don't forget about find() and split().

    Submit

    Submit your psearch.py to the online submission system under hw10-psearch.
    Your output must exactly match the above.

    submit -c=sd211 -p=hw10-psearch psearch.py