Skip to content

Instantly share code, notes, and snippets.

@benevidesh
Created April 25, 2017 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benevidesh/bd1f767cddbe54f1f65b5618c3d84395 to your computer and use it in GitHub Desktop.
Save benevidesh/bd1f767cddbe54f1f65b5618c3d84395 to your computer and use it in GitHub Desktop.
calcular coeficiente binomial
def factorial(x):
fact = count = 1
while count <= x:
fact = fact * count
count += 1
return fact
def coefBinom(n, k):
aux = factorial(n) // (factorial(k) * factorial(n - k))
return aux
n = int(input('Digite o valor de n: '))
k = int(input('Digite o valor de k: '))
print(coefBinom(n, k))
def factorial(x):
fact = count = 1
while count <= x:
fact = fact * count
count += 1
return fact
def coefBinom(n, k):
aux = factorial(n) // (factorial(k) * factorial(n - k))
return aux
print(coefBinom(10, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment