Python math.gamma() Method
Example
Find the gamma value of different numbers:
# Import math Library
import math
# Return the gamma value of
different numbers
print (math.gamma(7))
print (math.gamma(-4.2))
Try it Yourself »
Definition and Usage
The math.gamma() method returns the gamma value of a number.
The gamma value is equal to factorial(x-1).
Tip: To find the log gamma value of a number, use the math.lgamma() method.
Syntax
math.gamma(x)
Parameter Values
| Parameter | Description |
|---|---|
| x | Required. The number to find the gamma value of. If the number is a negative integer, it returns a ValueError. If it is not a number, it returns a TypeError. |
Technical Details
| Return Value: | A float value, representing the gamma value of a number |
|---|---|
| Python Version: | 2.7 |


