Could anyone tell me why I got a runtime error (NZEC)? Thanks a lot!
Code removed.
You cannot read until EOF that way. You'll find some hints about that in the forum.
Sorry, I still don't know how to fix it. Please tell me.
Search for "python eof" in the forum and you'll find what you need.
Thanks a lot!I used:
while 1: try: n=int(raw_input()) print #calculated value except: break
But I don't know whether there exist some easier ways.
I don't think that is complecated, but yes, there are other ways to read until eof.You can use stdin from module sys, which behaves like a file object. Then look for methods on file-objects, e.g. read(), readline() and readlines().You'll find explanations in the documentation of the stdlib: http://docs.python.org/release/2.6.6/library/index.html