Homework Assignment

Functions and Exceptions

Contents:


Overview

Topic: Functions and Exceptions
Related Reading: Chapter 5.2-5.5
Due:

Please make sure you adhere to the policies on academic integrity.


Problems to be Submitted (20 points)

  1. (5 points)

    Write a function acronym(phrase) that accepts a string as a parameter, and returns a new string that includes the first letter of every word in the original phrase, all in uppercase. For example, a call to acronym('Laughing out loud') should return the string 'LOL'.

  2. (5 points)

    Exercise 5.28 of the text

  3. (5 points)

    Exercise 5.30 of the text.
    Note that the letters requiring use of the article an in front of them are 'aefhilmnorsx'

  4. (5 points)

    Exercise 5.34 of the text

    Note that the solution to the last homework contains code for related Exercise 5.23 that you may use. The point of this exercise is to have you do proper error checking of the parameters (see Chapter 5.5 for coverage of error checking and exceptions).


Extra Credit

  1. (2 points)

    Exercise 5.26 of the text


Last modified: Monday, 22 February 2010