My issue
t = int(input())
for _ in range(t):
n = int(input())
s = input()
x = 0
for reply in s:
if int(reply) == 1:
x += 1
if x == n and int(reply) == 1:
print('YES')
else:
if int(reply) == 1:
print('IDK')
else:
print('NO')
Please help me with the logic. Dont know where i am going wrong. Also only one sample example is making hard for me.
My code
t = int(input())
for _ in range(t):
n = int(input())
s = input()
x = 0
for reply in s:
if int(reply) == 1:
x += 1
if x == n and int(reply) == 1:
print('YES')
else:
if int(reply) == 1:
print('IDK')
else:
print('NO')
Problem Link: 3 Logicians Walk into a Bar Practice Coding Problem - CodeChef