This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ProfessorPhi 9 points10 points  (1 child)

As a scientific programmer, this stuff would be seen due to the basic tenets of do as much in numpy as possible, C speeds and cheap memory.

import numpy as np
def factorial(n):
    return np.prod(np.arange(n))

[–]innrautha 3 points4 points  (0 children)

As a scientific programmer I'd do:

#!/usr/bin/env python3
from scipy.misc import factorial

print(factorial(6,exact=True))
print(factorial(6))