+ 1
How can calculate factorial in python
3 Answers
+ 5
calculating factorial is not language specific, you can make logic which will be valid mostly in all languages(can be loop, recursion etc).
Python have pre-defined function for calculating factorial:
import math
print(math.factorial(n))
#might its not available in other languages which I know
+ 3
You can very easily make factorial using for loops.
#Factorial of 6!
x = 1
y = 6
for i in range(2, y + 1):
x *= i
print(x)
#Output: 720