in reply to Re^4: Average calculation
in thread Average calculation

Depends on how cynical you are about people who ask homework questions.

The disadvantage of pointing the questioner to documentation, or answering the question at a high level (with no code), is that the questioner might keep coming back, asking question after question until every little step that requires intelligence above that of a stoned tadpole is answered. And a question like the original post tends to raise that suspicion -- it doesn't contain enough information to truly help the questioner understand what s/he is doing wrong, but coincidentally it does contain enough information to give a working solution to the problem. At the same time, there's still a very good chance that the questioner is not a slacker cheating on homework; s/he is just not all that good at asking questions.

Of course, by giving a working solution, you've just given the suspected leech exactly what s/he was looking for. Or did you? Most probably not -- any professor who received an obfuscated answer such as the one above is obviously going to know that it's not the student's original work.