Whats wrong in my code ? please help. (Python)

I was doing a question HEADBOB.i wrote a code but it is not working correctly (showing wrong output)
please help me with my code.

here is my code.

i think there is some problem in 5th line

please also explain how “if not” work in python 3

for i in range(int(input())):
    ng=int(input())
    l=input()
    q=0
    if not ('Y' or 'I') in l:
        print('NOT SURE')
        continue
    for j in range(len(l)):
        if 'I' in l:
            q=1
    if q==1:
        print('INDIAN')
        continue
    print('NOT INDIAN')

What’s really happening: demo
And why: docs

What you actually want to do is

if 'Y' not in l and 'I' not in l:
    ....

Hello! I am also having troubles with this task. The first code seems to be working in PyCharm but says “wrong answer” in the system and the second one doesn’t print anything at all. Maybe someone can help me by saying what in these codes I should change to make it work?

testcase = int(input())
for i in range(testcase):
amountOfthenumbers = int(input())
availableGestures = [‘Y’, ‘I’, ‘N’]
amountOfGestures = input()
userInput = [amountOfGestures]
if ‘Y’ in amountOfGestures and ‘I’ not in amountOfGestures and ‘N’ in amountOfGestures:
print(“NOT INDIAN”)
if ‘I’ in amountOfGestures and ‘N’ in amountOfGestures and ‘Y’ not in amountOfGestures:
print(“INDIAN”)
if ‘Y’ not in amountOfGestures and ‘I’ not in amountOfGestures and ‘N’ in amountOfGestures:
print(“NOT SURE”)

testcase = int(input())
for i in range(testcase):
amountOfthenumbers = int(input())
availableGestures = [‘Y’, ‘I’, ‘N’]
amountOfGestures = input()
if amountOfGestures in availableGestures:
userInput = [amountOfGestures]
if ‘Y’ in userInput and ‘I’ not in userInput and ‘N’ in userInput:
print(“NOT INDIAN”)
if ‘I’ in userInput and ‘N’ in userInput and ‘Y’ not in userInput:
print(“INDIAN”)
if ‘Y’ not in userInput and ‘I’ not in userInput and ‘N’ in userInput:
print(“NOT SURE”)

thanks i understand what i really want to do is “if ‘Y’ not in l and ‘I’ not in l:” and not " if not (‘Y’ or ‘I’) in l:" thanks for this
but i didn’t understand whats really happening in my code (which i wrote in question)

input=3

input=5

input=NNNYY

output=NOT INDIAN

input=6

input=NNINNI

output=NOT SURE

why it is showing output “NOT SURE” for input NNINNI.
how the code (which i posted in question) is generating output for different inputs.

can you please explain how my code is generating a particular outputs for inputs written above