Cathy James, 19.06.2011 01:21:
def fileProcess(filename):
     """Call the program with an argument,
     it should treat the argument as a filename,
     splitting it up into words, and computes the length of each word.
     print a table showing the word count for each of the word lengths
that has been encountered.
     Example:
     Length Count
     1 16
     2 267
     3 267
     4 169
     >>>"&"
     Length    Count
     0    0
     >>>
     >>>"right."
     Length    Count
     5    10
     """

Note that ">>>" is commonly used in docstrings to implement doctests. That is, it should represent the beginning of a line (or more) of executable Python code, followed by the expected output for that code.

Example:

    def add(x,y):
        """Add two numbers.

        >>> 1+1
        2
        >>> add(1,1)
        2
        >>> add(1,1) == 1+1
        True
        """
        return x+y

http://docs.python.org/library/doctest.html

Stefan

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to