Python, Error while taking input

I am having the same problem, except I got the error both in competition and with the ide. I would also appreciate a solution. The error is occurring with this line:

t = int(input())

19 Likes

If your code takes some input, then you have to provide custom input for your program otherwise it will show NZEC error. Just provide an appropriate input and it works fine.

12 Likes

For the contest and practice submissions, isn’t codechef supposed to provide the input? I’m getting that error with contest and practice submissions. I notice my code works on some online compilers and not others, with codechef being one of the compilers it doesn’t work on.

18 Likes

I am also facing the same issue. Did anyone find a solution?

2 Likes

Hey, you guys should try just submitting. It works. I think ‘RUN’ and ‘SUBMIT’ run on different compilers/machines and ‘RUN’ is broken right now.

14 Likes

If you are trying to run the code in IDE mode then you must provide custom input, otherwise you will get NZEC.
This is the only reason you are getting this error. If you wanna submit then just submit. So RUN and SUBMIT both are different functionalities. In case of SUBMIT, codechef gives it’s test cases. But in case of RUN, you should give input.

25 Likes

Text Input
Want to get keyboard input?

To get keyboard input, use the input function. Inside the terminal you’ll be able to type text.

In Python 3 you can use the input() function, older versions of Python have the raw_input() function.

Related Courses: Python Crash Course
User Input
The input function has a return variable. In this case the keyboard input. If we do not store the return variable into a programs variable, we lose it. That’s why we write a variable to store the result in.

To get a text value:

name = input("Enter a name: ")
print(name)

This will show you:
Enter a name:

You can now give keyboard input, it will be stored in the variable name.

Note: don’t forget to store the return variable. variable = input(“…”)

1 Like

I was also facing the same issue 2 days back…when I was in a competition organized by Jaypee College…It really sucks…I think some times using strip() with input helps…:slight_smile:

1 Like

You are getting EOF error. That means there was no input but you still tried to read something. Can you share your submission link for which you are getting this error?

2 Likes

Hi,
The link to my solution is the following:
https://www.codechef.com/viewsolution/22062856

This code worked perfectly during the competition, but it is not running in the ide. I have been getting the same error for all the problems that I have attempted so far in ide.
Thanks for your help.

After banging my head for for some time I got the solution.
The IDE expects custom input to be provided.
Just select Custom input below IDE box and copy paste the input values provided with problem statement in the Custom input box below Run/Submit.
Bingo, whatever you did will be run successfully.
This should make things work for any language since IDE expects custom input.
But codechef should not be that dumb to tax people & provide inputs all the time. They should improve.

8 Likes

i have used codeforces and hackerearth where these in(input()) works really fine,codechef is a little different it works when i m not in ide mode otherwise it does not.codechef sholud improve its inbuilt ide.

5 Likes

you to give the input in the custom input so that it can take an input from there

Can you give an example, please? I don’t understand what you mean with ‘Just provide an appropiate…’. Thank you!

When I run the code with costume input it works perfectly fine and also provide the correct output. While submitting provide me the NZEC error! Please help me.

4 Likes

I am also getting the same error. while taking input:
here is my sample code:

number_of_input = int(input())
for j in range(number_of_input):
action, val = input().split()
val = int(val)
if action == ‘i’:
bst.insert(val)
elif action == ‘d’:
bst.delete(val)
else:
print(“input error”)
pass

i am getting EOFerror in first line. when i am trying to submit code. it’s running perfectly with sample input or in my Intelliz ide.

Please help or provide solution.
Thanks in advance.

1 Like

use
action,val=map(int,input().split())

1 Like

For this problem: t = int(input()) and showing the error of EOF. Just switch to non-ide mode and then submit the code, it will run and submit successfully.

could you please explain how does it happen

I am trying to submit #BSTOPS using python3. My code is working perfectly fine with custom input but i am getting runtime error on submission. Please help.

2 Likes