MCPcopy Create free account
hub / github.com/Mrinank-Bhowmick/python-beginner-projects / binomial

Function binomial

projects/Calculator/main.py:129–137  ·  view source on GitHub ↗

Function to calculate the binomial coefficient. Takes two numbers as arguments, calculates the binomial coefficient using the formula n!/(k!(n-k)!), and returns the result.

(num)

Source from the content-addressed store, hash-verified

127
128
129def binomial(num):
130 """
131 Function to calculate the binomial coefficient.
132
133 Takes two numbers as arguments, calculates the binomial coefficient using the formula n!/(k!(n-k)!),
134 and returns the result.
135 """
136 result = factorial(num[0]) / (factorial(num[1]) * factorial(num[0] - num[1]))
137 return result
138
139
140c = 0

Callers 1

main.pyFile · 0.85

Calls 1

factorialFunction · 0.85

Tested by

no test coverage detected