You missed the part where a value is passed in, processed, and returned.
Don't just hand him complete working code. He made no attempt to write any
code himself, and he won't learn anything until he does, and it's
obviously homework, the first assignment of the semester by the look of it.
Snippets of code should be wrapped in
<code> tags not<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).