human
Trinomial Triangle | Function to find the trinomial triangle value ..
base case.
base cas.
recursive step ..
Function to print Trinomial Triangle of height n ..
printing n rows ..
printing first half of triangle.
printing second half of triangle ..
Driven Code"
How can the above be solved in Python?
 Can you provide a code to trinomial Triangle and the other steps required?
assistant
#Here is code to trinomial Triangle and the other steps required.
 def TrinomialValue ( n , k ) :
	if n == 0 and k == 0 :
		return 1
	if k < - n or k > n :
		return 0
	return ( TrinomialValue ( n - 1 , k - 1 ) + TrinomialValue ( n - 1 , k ) + TrinomialValue ( n - 1 , k + 1 ) )
def printTrinomial ( n ) :
	for i in range ( n ) :
		for j in range ( - i , 1 ) :
			print ( TrinomialValue ( i , j ) , end = " ▁ " )
		for j in range ( 1 , i + 1 ) :
			print ( TrinomialValue ( i , j ) , end = " ▁ " )
		print ( " " , end = ' ' )
n = 4
printTrinomial ( n )