I’ve the following python 2.7.3 code which I am submitting to codechef online programming contest:
case = input() for i in xrange(0, case): try: l = [elem for elem in raw_input().split()] res = int(l[::-1]) + int(l[::-1]) print int(str(res)[::-1]) except: break
This works on my computer, even when I use input redirection and use a in.txt file for input, still it works.
But the problem is when i submit it for evaluation, I get an exception(NZEC) and that exception gets removed when I use raw_input for getting the value of case
case = int(raw_input())
My in.txt file is as follows:
1 23 45
My problem is that it’s working on my computer perfectly, what is it that the online contest site feeding at the 1st line that an exception is being raised, and further it gets rectified when I use raw_input.
Shouldn’t input() also work when my 1st line is always an integer?