if **name** == “**main**”:

t=int(input())

while(t>0):

m,n=map(int,input().split())

for num in range(m,n+1):

if is_prime(num):

print(num)

t-=1

print()

def is_prime(num):

if num==2 or num==3:

return True

if num%2==0:

return False

for i in range(3,num,2):

if num%i==0:

return False

return True

I’ m getting error that **“is_prime” is not define** but just putting def function above all , code working correctly.Can anyone explain me why ?