My issue
t = int(input())
for _ in range(t):
a = int(input())
l = list(map(int, input().split()))
s1 = sum(l)
if a == 1:
if s1 % 2 == 0:
print(1)
else:
print(0)
continue
while s1 % 2 != 0:
s1 -= l.pop()
print(len(l))
My code
t = int(input())
for _ in range(t):
a = int(input())
l = list(map(int, input().split()))
s1 = sum(l)
if a == 1:
if s1 % 2 == 0:
print(1)
else:
print(0)
continue
while s1 % 2 != 0:
s1 -= l.pop()
print(len(l))
Problem Link: Even Sum Subarray Practice Coding Problem