loop

Chris Angelico rosuav at gmail.com
Mon Mar 24 06:58:29 EDT 2014


On Mon, Mar 24, 2014 at 9:04 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Once in college, we were given assembly programming assignments. The
> textbook defined an imagined 18-bit CPU and an instruction set.
>
> A fellow student was given the task to write a subroutine that
> calculates the factorial of the argument. He went through the trouble of
> creating a loop with multiplication etc. I argued (in vain) that his
> solution is "wrong" from all angles; he should have implemented his
> subroutine with a simple lookup table since 18 bits can only take a
> handful of input values (0 through 8).

The task was "calculates". If the task was "returns", then the lookup
table would be correct. :)

ChrisA



More information about the Python-list mailing list