human
Write me a code to sum of all products of the Binomial Coefficients of two numbers up to K and the other steps required given the following:
Sum of all products of the Binomial Coefficients of two numbers up to K | Function returns nCr i . e . Binomial Coefficient.
Initialize res with 1.
Since C ( n , r ) = C ( n , n - r ).
Evaluating expression.
Function to calculate and return the sum of the products.
Initialize sum to 0.
Traverse from 0 to k.
Driver code"
Solution in Python:
assistant
#Here is code to sum of all products of the Binomial Coefficients of two numbers up to K and the other steps required.
 def nCr ( n , r ) :
	res = 1
	if r > n - r :
		r = n - r
	for i in range ( r ) :
		res *= ( n - i )
		res /= ( i + 1 )
	return res ;
def solve ( n , m , k ) :
	sum = 0 ;
	for i in range ( k + 1 ) :
		sum += nCr ( n , i ) * nCr ( m , k - i )
	return int ( sum )
if __name__ == ' _ _ main _ _ ' :
	n = 3
	m = 2
	k = 2 ;
	print ( solve ( n , m , k ) )