human
Find n | Return n - th number in series made of 4 and 7.
create an array of size ( n + 1 ).
If i is odd.
Driver code"
How can the above be solved in Python?
assistant
#Here is code to find n and the other steps required.
 def printNthElement ( n ) :
	arr = [ 0 ] * ( n + 1 ) ;
	arr [ 1 ] = 4
	arr [ 2 ] = 7
	for i in range ( 3 , n + 1 ) :
		if ( i % 2 != 0 ) :
			arr [ i ] = arr [ i // 2 ] * 10 + 4
		else :
			arr [ i ] = arr [ ( i // 2 ) - 1 ] * 10 + 7
	return arr [ n ]
n = 6
print ( printNthElement ( n ) )