can someone please point out to me whats wrong with code .
lens = int(input()) arrs = [int(x) for x in input().split()] petu,ketu = 0, 0 while len(arrs) > 0: petu += arrs.pop(0) if len(arrs)>0: ketu += arrs.pop() print(abs(petu - ketu))
What I had done is
While there is a value petu point is incrementred with pop(0),if still there is something ketu’s point is incremented with pop.
This process continues till array is empty.
Abs value of petu - ketu should be the answer.
But this is failing on some cases and i would like to know why