human
Give me a code to ways of selecting men and women from a group to make a team and the other steps required given the following:
Ways of selecting men and women from a group to make a team | Returns factorial of the number.
Function to calculate ncr.
Function to calculate the total possible ways.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to ways of selecting men and women from a group to make a team and the other steps required.
 def fact ( n ) :
	fact = 1
	for i in range ( 2 , n + 1 ) :
		fact *= i
	return fact
def ncr ( n , r ) :
	ncr = fact ( n ) // ( fact ( r ) * fact ( n - r ) )
	return ncr
def ways ( m , w , n , k ) :
	ans = 0
	while ( m >= k ) :
		ans += ncr ( m , k ) * ncr ( w , n - k )
		k += 1
	return ans ;
m = 7
w = 6
n = 5
k = 3
print ( ways ( m , w , n , k ) )