Tim Golden wrote: >> From the cookbook, this time. >> It satisfies the requirements nicely ;) >> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496691 > > [... snip the ultimate general-purpose answer to the OP's question ... > > I really hope that's a wink up there, Marco.
The wink is in the second line of my post... more for the "do the least amount of work to meet the requirements" people that for the OP > The poor guy was just trying to get his homework done! I don't see how my answer is in any way worse than those based on lambda. Maybe I'm just envious because when I was his age I couldn't google for answers. He should at least be able to do that, shouldn't he? But wait. That would mean understanding what a factorial is. That would require a second search, or a textbook, or an understanding of arithmetics before programming with or without recursion. Should we blame the teachers? -- http://mail.python.org/mailman/listinfo/python-list