EOF error problem while taking input.

I am unable to run any program in python 3 ide because of the EOF error on the first line itself while taking the input for the number of test cases. I used
T = int(input())
Please provide a solution.

3 Likes

use try / except
e.g:

try:

   T = int(input())

except:

   pass
6 Likes

Thank you. That worked.

1 Like

When I used try/except, it said ‘t’ is not defined.
What should I do?

4 Likes

Ye I am also getting the same error as goku548 said.Please can anyone solve my problem.

2 Likes

put your whole code in try block and in last
except:
pass

1 Like

Instead write your code in a for loop as
for i in range(int(input())):
//Remaining code

2 Likes

I FOUND THE SOLUTION!!!
Switch to the NON-IDE mode and copy your code their and submit it.
MAKE YOUR CODE IS WORKING IN OTHER IDE (LIKE PYCHARM OR ANY IDE OTHER THAN OF CODECHEF) .I was also stuck here and finally found the solution after 2 hours.
HAPPY CODING

8 Likes

it dose’t work for me either

I know it’s very late but I am posting it, so that no one has to struggle to find a solution to this problem.
I have been searching a lot about this and i came across this solution:
You do not need to declare a variable for t as in
t = int(input())
for i in range(t):
#remaining code
Instead of this, just start your code with:
for i in range(int(input())):
#remaining code
This will not give EOFError, this is how they build this system.
Hope, This Helps.

3 Likes

I still have the same issue.
This is strange.

1 Like

try:
t = int(input())
while t != 0:
# your code

    t=t-1

except:
pass

try this

i don’t know what is the issue with IDE mode but as what @prakx20501 said, " switching to non - IDE mode did the job for me.

If someone from @admin @admins reading this please provide the cause of issue and the solution to it.

1 Like

Have you provided custom input. I hope you know running without custom input will make your program work on empty input, not the example test cases.

1 Like

So its not like the other website (example : LeetCode ) ?
I mean there is no sample input, no auto initial test case that automatically run on you code and test it before final submission?

Cool. Problem solved. Thank you stranger for teaching me this about codechef .

1 Like

That’s right :slight_smile: New to Codechef. Can't understand the platform

1 Like

For people using Python2, you can use:
T = int(raw_input())
instead of
T = int(input())

thank you …

This worked for me but what is the difference

1 Like

Thanks for the info. It helped me after scratching my head for a good hour.