How to factor using Python?

Joe Riopel goon12 at gmail.com
Tue Mar 11 15:38:22 CET 2008


On Mon, Mar 10, 2008 at 1:08 AM, Nathan Pinno <MadComputerGuy at gmail.com> wrote:
> How do I factor a number? I mean how do I translate x! into proper
>  Python code, so that it will always do the correct math?

This should work to do x! (factorial of x).

reduce(lambda x,y: x*y, range(1, x+1))



More information about the Python-list mailing list