a = input().split()
d = 0
i=0
while i<len(a) :
d+=int(a[i])
if d < 0:
break
print(a[i])
i+=1
I don't understand, What is going wrong here?
Hey @snehill090, we need to make sure that we follow the input format given in the question. So in the sample input , you have to take the input as :
1
2
88
-100
49
But your code takes input in a single line and then splits it which won’t work here. Try to use a while loop for taking the input again and again till the condition of ques goes false.
I hope this helps !
Happy Learning ! 
Thankyou Sir! It works… Just showing run error
a = [] sum = 0 m = True while m: n = int(input()) if sum>=0: if sum+n>0: a.append(n) else: break sum+=int(n) for i in a: print(i)
Ok!! Got it🙌 Thanks.
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.