def solution(A):
left = 0
right = 0
left = A[0]
right = sum(A[1:])
m = abs(left-right)
if(len(A)==2):
return m
for a in A[1:-1] :
print(left,right, abs(left-right))
left = left + a
right = right - a
m = min(m , abs(left-right))
return m
def solution(A):
sumA = sum(A)
part = A[0]
minimum = abs( 2 * part - sumA )
for i in A[1:-1]:
part += i
if abs( 2 * part - sumA ) < minimum:
minimum = abs( 2 * part - sumA )
return minimum