what is the general reason for nzec error in python
NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement. Other languages like Python could generate this error if they throw an exception.
So, it would depend on how input is being taken by your program, and how are the input files of the setter set - that is, with spaces at the end, etc., and many other factors. For example, when you tried to do raw_input().split(" ") , it will give NZEC because when problem setter tried to upload the I/O test cases they ended up leaving a space at the end. Can you share the problem, and the code for which you’re getting NZEC?
In general, raw_input() take input as a string. Then, you need to split it and convert it into the format you need. The general format used is:
lis = map(int, raw_input().split())
Can you please explain me the importance of map function…?
Yes if there is a problem in your input methods or you are using psyco module in your code it may lead to NZEC error.
The NZEC error in Codechef (or internal error in SPOJ) has been occuring frequently to me even in trivial codes with python 3, even though the identical code gets accepted in ruby. I don’t know what is the reason behind this. The November long contest is still on so I can’t post the code. But they worked like a chram on my laptop or any other laptop of my friends that I tried.