EOF error while running

where am i doing wrong it showing eof in line 3
sum=0
while(True):
a=int(input())
sum+=a
if(sum>=0):
print(a)
else:
break

Please post the code as well.

sum=0
while(True):
a=int(input())
sum+=a
if(sum>=0):
print(a)
else:
break

Hey Pankaj,
Are you indentating the code properly?

An EOFError is raised when a built-in function like input() or raw_input() do not read any data before encountering the end of their input stream. The file methods like read() return an empty string at the end of the file
use : [int(i) for i in input().split()]
instead int(input())

tell me if any other doubt

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.