human
Give me a code to permutation Coefficient and the other steps required given the following:
Permutation Coefficient | Returns value of Permutation Coefficient P ( n , k ).
Calculate value of Permutation Coefficient in bottom up manner.
Base cases.
Calculate value using previously stored values.
This step is important as P ( i , j ) = 0 for j > i.
Driver Code"
How can the above be solved in Python?
assistant
#Here is code to permutation Coefficient and the other steps required.
 def permutationCoeff ( n , k ) :
	P = [ [ 0 for i in range ( k + 1 ) ] for j in range ( n + 1 ) ]
	for i in range ( n + 1 ) :
		for j in range ( min ( i , k ) + 1 ) :
			if ( j == 0 ) :
				P [ i ] [ j ] = 1
			else :
				P [ i ] [ j ] = P [ i - 1 ] [ j ] + ( j * P [ i - 1 ] [ j - 1 ] )
			if ( j < k ) :
				P [ i ] [ j + 1 ] = 0
	return P [ n ] [ k ]
n = 10
k = 2
print ( " Value ▁ fo ▁ P ( " , n , " , ▁ " , k , " ) ▁ is ▁ " , permutationCoeff ( n , k ) , sep = " " )