Help me in solving CS2023_STK problem

My issue

t=int(input())
while t:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=0
d=0
o=
y=
for h in range(0,n):
if a[h]>=1:
c+=1
elif a[h]==0:
o.append(c)
c=0
if b[h]>=1:
d+=1
elif b[h]==0:
y.append(d)
d=0
if max(o)>max(y):
print(“OM”,c)
elif max(o)<max(y):
print(“Addy”,d)
else:
print(“DRAW”)
t-=1
how my list is emty

My code

# cook your dish here
t=int(input())
while t:
    n=int(input())
    a=list(map(int,input().split()))
    b=list(map(int,input().split()))
    c=0
    d=0
    o=[]
    y=[]
    for h in range(0,n):
        if a[h]>=1:
            c+=1
        elif a[h]==0:
            o.append(c)
            c=0
        if b[h]>=1:
            d+=1 
        elif b[h]==0:
            y.append(d)
            d=0
    if max(o)>max(y):
        print("OM",c)
    elif  max(o)<max(y):
        print("Addy",d)
    else:
        print("DRAW")
    t-=1

Learning course: Arrays using Python
Problem Link: Practice Problem in - CodeChef

Consider the scenario where both members streaks are given as

  • For 4 days
    1 1 1 1
    1 1 1 1
  • No zero i.e, you never append an element to your lists. To resolve this testcase, after the loop just add
    o.append(c)
    y.append(d)

Your code will work fine.

thak you