human
Check if final remainder is present in original Array by reducing it based on given conditions | Python program to implement above approach.
copying original array.
loop till length of array become 2..
find middle element.
pop element from front and rear.
find remainder.
append remainder to a.
now since length of array is 2 take product and divide it by n.
if remainder is present is original array return 1 , else return 0.
calling function Reduced.
if x = 1 print YES else NO"
How can the above be solved in Python?

=====
Can you provide a code to check if final remainder is present in original Array by reducing it based on given conditions and the other steps required?
assistant
#Here is code to check if final remainder is present in original Array by reducing it based on given conditions and the other steps required.
 def Reduced ( a , n ) :
	original_array = a [ : ]
	while len ( a ) != 2 :
		mid = len ( a ) // 2
		mid_ele = a [ mid ]
		start = a . pop ( 0 )
		end = a . pop ( )
		rmd = ( start * end ) % mid_ele
		a . append ( rmd )
	remainder = ( a [ 0 ] * a [ 1 ] ) % n
	if remainder in original_array :
		return 1
	return 0
Arr = [ 2 , 3 , 4 , 8 , 5 , 7 ]
N = len ( Arr )
x = Reduced ( Arr , N )
if x :
	print ( " YES " )
else :
	print ( " NO " )