Error in simple input

I am getting an error, but my code is working properly in Jupyter .
b=input()
a=[int(n) for n in b.split()]
s=0;
for e in a:
s+=e
if s<0:
break
else:
print(e)

Hey @Shivam31, that is because on backend every number is in new line, you can’t use
a=[int(n) for n in b.split()].

Try using while loop, keep running the while loop, and come out of while loop when sum<0. Take input in this loop only (number by number)

Hope this resolved your doubt.
Plz mark the doubt as resolved in my doubts section. :blush:

hey @Shivam31 ,
Can you please explain what error are you getting.

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.