Getting TLE error

def prime(s,e):
flag=0
for j in range(s,e+1):
n=j
w=n/2
i=2
if(i==w):
flag=1
while i<w:
if(n%i==0):
flag=1
i+=1
if flag==0:
print(n,end=’\t’)

    flag=0

time=int(input())
k=time
ss=[]
while time>0:
a,b=input().split()
ss.append(a)
ss.append(b)
time-=1

for m in range(k):
a=int(ss[0])
b=int(ss[1])
prime(a,b)
ss.pop(0)
ss.pop(0)
print(’\n’)
m+=1

this my code. it was working fine in jupyter. but the coding block console throws TLE error

Hey @kannan, TLE stands for time limit exceeded. It is not because of changing from jupyter to coding blocks console, but due to the high complexity of your code. Try to optimize your code so that it computes the answer with less number of iterations.

Hope this helps !
Happy Learning :slight_smile: