The math.gamma() function is used to calculate the Gamma function( Γ(x)) of a given number. The Gamma function is an extension of the factorial function it is defined by the following equation: Γ(x) = (x-1)!

However, there is an important distinction between gamma and factorials. While, factorials calculates the number of permutations when a partial arrangement is not allowed, Gamma function  is used to calculate the number of permutations when a partial arrangement is also allowed. A resulting effect is that we can get the gamma function of floating point values which is impossible with factorials.

math.gamma(x) 

Where, parameter x is a real number for which the Gamma function is to be calculated. 

This function returns the Gamma function of as a floating point value.

import math 

print(math.gamma(3))
print(math.gamma(4))
print(math.gamma(5))
print(math.gamma(6))
print(math.gamma(2.5))
print(math.gamma(3.142))
print(math.gamma(math.e))
print(math.gamma(10.2567))