I always get a wrong answer in a correct program. Can anybody please tell why this is wrong

def checkprime(num):
for i in range(2,num):
if num%i==0:
return 0
return 1
k,q=input().split()
a=[]
b=[]
for i in range(int(q)):
b.append(input().split())
if b[i][0]=="!":
if len(a)<=int(b[i][1]):
for j in range(len(a),int(b[i][2])+1):
if j<int(b[i][1]):
a.append(" “)
else:
a.append(int(b[i][3]))
else:
for j in range(int(b[i][1]),int(b[i][2])+1):
if j<len(a):
if a[j]==” “:
a[j]=int(b[i][3])
else:
a.append(int(b[i][3]))
print(a)
elif b[i][0]==”?":
cont=0
for y in range(2,int(k)+1):
if checkprime(y):
if int(k)%y==0:
for z in range(int(b[i][1]),int(b[i][2])+1):
if z<len(a):
if a[z]!=" " and a[z]%y==0:
cont+=1
break
print(cont)

Where is the question? Also, please format your code.

Hey, could you please give me your email id or mail me once at raunak11khemka1999@gmail.com
So that I can send you the question and my code.
It would be a great help.
Thanks

why you can’t share a link or image here?

This is the question and below is my code.
Could you please tell me what mistake have I made.
Thanks a Lot.

https://www.codechef.com/viewsolution/33619198

at first sight I would say that one error might be that you are saying that 2 is not prime

no, it returns 1 when the input to the checkprime function is 2

yep, you’re right.

The WA veredict might come from the “print(a)” line. You are not expected to output anything in first type queries. Anyway, I tried your code without that line and now the veredict is TLE, so you should try to optimize it

I only added print(a) when I was trying to debug the code, it is not a part of the initial code and still I am getting a wrong answer.
Thanks for helping, though