human
Check if sum of array can be made equal to X by removing either the first or last digits of every array element | Utility Function to check if the sum of the array elements can be made equal to X by removing either the first or last digits of every array element.
Base Case.
Convert arr [ i ] to string.
Remove last digit.
Remove first digit.
Recursive function call.
Function to check if sum of given array can be made equal to X or not.
Driver Code.
Function Call"
How can the above be solved in Python?
 What is a code to check if sum of array can be made equal to X by removing either the first or last digits of every array element and the other steps required?
assistant
#Here is code to check if sum of array can be made equal to X by removing either the first or last digits of every array element and the other steps required.
 def makeSumX ( arr , X , S , i ) :
	if i == len ( arr ) :
		return S == X
	a = str ( arr [ i ] )
	l = int ( a [ : - 1 ] )
	r = int ( a [ 1 : ] )
	x = makeSumX ( arr , X , S + l , i + 1 )
	y = makeSumX ( arr , X , S + r , i + 1 )
	return x | y
def Check ( arr , X ) :
	if ( makeSumX ( arr , X , 0 , 0 ) ) :
	print ( " Yes " )
	else :
	print ( " No " )
arr = [ 545 , 433 , 654 , 23 ]
X = 134
Check ( arr , X )