Problem with IDE

I am trying to submit code for CAVECOIN problem in LOCJUL17 in python. But it’s throwing RE(NZEC).

I tried very simple code which is working on manual input but is not working with default input and throwing

  File "prog.py", line 1, in <module>
EOFError: EOF when reading a line```

Even for this code:

```for _ in range(input()):
    print "done"```

But Same Works if I manually enter this input:

1 


3 2 


0 1 


2 3 


4 4 


110 


and same basic code in c++ works for both(custom Input and Default Input):

```#include iostream

using namespace std;

int main() {

int t;

cin>>t;

cout<<"yey\n";
	
return 0;

}```


@admin can you please look into this..

Are you sure that your method of input is correct? Sometimes when you copy the sample input, there is a extra space/trailing space, does erasing that helps?

I used to get that error for input errors.

can anyone please tell me the approach to solve it …because the solutions are not available…

for _ in range(input()):
print “done”

By default, Python converts an input to a string. You need to convert it to an integer using the int function like this:

for _ in range(int(input())):
    print "done"

And the major error I think is that you are using Python 3.5 and not applying braces around the print function. In Python 3, print is a function and no longer a statement. Try this:

for _ in range(int(input())):
    print("done")
1 Like

I tried this…

def takeInput():
    temp = raw_input().strip()
    while(temp == ""):
        temp = raw_input().strip()
    return temp

for _ in range(int(takeInput())):  
    print "Done"

But even this is not working -_-

I have tried to answer it where you asked it… please look into that…

Chill bro… :stuck_out_tongue: It’s not first time I am coding in python… :stuck_out_tongue: (Sorry for saying like this…), I am using python 2.7.13 here… and in it, print is not a function and input() will handle integer input… And also… If you would read above carefully I am saying it’s working fine with manual custom input even after adding unnecessary spaces between line, at end of line etc… check my another other code in vijju123 reply…

Btw… If you are assuming that I was using Python 3.5, Did you check it with python2.7.13?? Did it work for you in that case??

@kauts_kanu I don’t think the CodeChef IDE supports interactive mode. You put the standard input at the start. It works fine in C++, because if you try

#include <iostream>

using namespace std;

int main() {

int t;

cin>>t;

cout<<t << " " << "yey\n";

return 0;

}

you’ll see that t is automatically assigned a value of 0.

1 Like

ha… I just saw this thing with CodeChef IDE…

But In that case my question would be why my this python solution is giving RE(NZEC) for ALL testcases, but similarly implemented this C++ solution(https://www.codechef.com/viewsolution/14732254) got AC without any error… I checked my python solution(https://www.codechef.com/viewsolution/14730171) over random inputs… which I suppose atleast cover all testcases in 1 subtask…

I was using above IDE example because I was thinking there was some problem in IDE but looks like there was some problem in input format of problem(except extra new lines and unnecessary spaces at end and start of line, because even this python solution not worked… https://www.codechef.com/viewsolution/14730258).

So possible error I am thinking is… They did not use new line character in input file, is the only reason I can think of why python solution not worked and c++ solution worked…

I asked if there is any problem with input file format… but no one replied… And you can also see that there are some accepted solution in python https://www.codechef.com/LOCJUL17/status/CAVECOIN?sort_by=All&sorting_order=asc&language=4&status=15&handle=&Submit=GO so now I am thinking there is something wrong in my code but could not figure out what…-_-