Submitted By: captainhampton
Actions:
Rating:
Views: 3,654

Language: Python

Last Modified: September 2, 2010
Instructions: Give the function an n and k as the formula for Binomial Coefficient to be calculated.

Snippet


  1. #Calculates the Binomial Coefficient
  2.  
  3. from math import factorial
  4.  
  5. def Binomial(n,k):
  6.         if n > k:
  7.                 b = factorial(n) / (factorial(k)*factorial(n-k))
  8.                 return b

Copy & Paste


Comments

There are currently no comments for this snippet. Be the first to comment!

Add comment


You must be registered and logged on to </dream.in.code> to leave comments.