There are several way to calculate a factorial of a number. This uses the builtin function reduce:
 >>> import operator

>>> reduce(operator.mul, range(5, 0, 1))

120
This uses recursion:
 >>> def factorial(n):

... if n == 0:

... return 1

... return n*factorial(n1)

...

>>> factorial(5)

120

>>>
A simple for loop:
 >>> x = 5

>>> v = 1

>>> for i in range(5, 0, 1):

... v *= i

...

>>> v

120

>>>
Choose what is best for your application.