human
Compare sum of first N | Function that returns true if sum of first n - 1 elements of the array is equal to the last element.
Find the sum of first n - 1 elements of the array.
If sum equals to the last element.
Driver code"
How can the above be solved in Python?
 ... Give me a code to compare sum of first N and the other steps required?
assistant
#Here is code to compare sum of first N and the other steps required.
 def isSumEqual ( ar , n ) :
	sum = 0
	for i in range ( n - 1 ) :
		sum += ar [ i ]
	if ( sum == ar [ n - 1 ] ) :
		return True
	return False
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 2 , 3 , 4 , 10 ]
	n = len ( arr )
	if ( isSumEqual ( arr , n ) ) :
		print ( " Yes " )
	else :
		print ( " No " )