My experience is that the average student usually has no trouble understanding how to use a function. They grasp the mechanics pretty quickly from examples. Issues such as the difference between printing a result and returning a result are confusing to some, as are issues such as scope. But you don't need to have a perfect understanding of such things to use functions effectively.I didn't have a chance to test the following on students but I think the Python interpreter offers a chance to postpone the print/return difference by just not teaching "print" (except parhaps as a debugging aid). A "hello world" program should be just::
>>> "Hello, world!"
I think that introducing arguments and return values is much simpler to understand than textual input/output usually taught with languages that lack a convenient interpreter prompt.
By far the biggest difficulty I've seen students have is deciding how and when to make their own functions. This is exacerbated by the fact that in beginning programming you typically only write small programs where writing your own functions might not be useful.Writing only small programs is harmful. Students must get the chance to write medium programs and to refactor them a lot. I think that any attempt at teaching good style and structure by "here is how you should write" is futile. Only by experiencing the hard way how is it to program without good structure will one learn its importance.
-- Beni Cherniavsky <[EMAIL PROTECTED]>, who can only read email on weekends. _______________________________________________ Edu-sig mailing list [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/edu-sig
