Code not working

arr =[]
for i in range (1,109):
arr.append(0)
#print(arr)
p=2
while p*p<10
9:
if arr[p]==0:
j=p*p
while j < 10**9:
arr[j]=1
j+=p
p+=1
x=int(input())
while x>=0:
a=int(input())
b=int(input())
for i in range (a,b+1):
if arr[i]==0:
print(i,end=" ")
print()
x-=1

Hey saurabh,
Try this simplest approach :

sum = 0
numbers = []
while sum >=0:
   n = int(input())
   sum+= n
   if sum<0:
      break
   numbers.append(n)

print numbers

this is not the solution of this question

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.