human
Find the Nth row in Pascal 's Triangle | Function to find the elements of rowIndex in Pascal 's Triangle.
1 st element of every row is 1.
Check if the row that has to be returned is the first row.
Generate the previous row.
Generate the elements of the current row by the help of the previous row.
Return the row.
Driver Program"
How can the above be solved in Python?
assistant
#Here is code to find the Nth row in Pascal 's Triangle and the other steps required.
 def getRow ( rowIndex ) :
	currow = [ ]
	currow . append ( 1 )
	if ( rowIndex == 0 ) :
		return currow
	prev = getRow ( rowIndex - 1 )
	for i in range ( 1 , len ( prev ) ) :
		curr = prev [ i - 1 ] + prev [ i ]
		currow . append ( curr )
	currow . append ( 1 )
	return currow
n = 3
arr = getRow ( n )
for i in range ( len ( arr ) ) :
	if ( i == ( len ( arr ) - 1 ) ) :
		print ( arr [ i ] )
	else :
		print ( arr [ i ] , end = " , ▁ " )