Factorial in Python

The factorial operation is encountered in many areas of mathematics, notably in permutations, combinations, algebra, and mathematical analysis. In python program we use for loop iterating by sequence index, which is an alternative way of iterating through each item is by index offset into the sequence itself.