As I wrote in my comment, it's a 32bit problem. If you have a 64bit system, you can still calculate up to 20!
Here is a solution without numpy, with the python builtin types, which handle such problems pretty safely:
def factorial(n):
result = 1
for i in range(1, n+1):
result *= i
return result
n = input("n! (for n<31)\n\nEnter n: ")
print("n!: %d" % factorial(n))
And here is a recursive function to bend your mind ;-)
def factorial_r(n):
if n < 2:
return 1
return n * factorial_r(n-1)
n = input("n! (for n<31)\n\nEnter n: ")
print("n!: %d" % factorial_r(n))