Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StopIteration Error for IO_in1 #83

Open
drmingle opened this issue Dec 29, 2020 · 1 comment
Open

StopIteration Error for IO_in1 #83

drmingle opened this issue Dec 29, 2020 · 1 comment

Comments

@drmingle
Copy link

I tried to run this code and received a StopIteration error.

# IO_in1.txt
import sys
inputs = iter(sys.stdin.readlines())
TC = int(next(inputs))
for _ in range(TC):
    print(sum(map(int, next(inputs).split())))

Can you tell me how to prevent this traceback?

---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-221-4615b4523133> in <module>
      1 import sys
      2 inputs = iter(sys.stdin.readlines())
----> 3 TC = int(next(inputs))
      4 for _ in range(TC):
      5     print(sum(map(int, next(inputs).split())))

StopIteration: 
@stevenhalim
Copy link
Owner

stevenhalim commented Jan 4, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants