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.
use try / except
e.g:
try:
T = int(input())
except:
pass
Thank you. That worked.
When I used try/except, it said ‘t’ is not defined.
What should I do?
Ye I am also getting the same error as goku548 said.Please can anyone solve my problem.
put your whole code in try block and in last
except:
pass
Instead write your code in a for loop as
for i in range(int(input())):
//Remaining code
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
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.
I still have the same issue.
This is strange.
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.
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.
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 .
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
Thanks for the info. It helped me after scratching my head for a good hour.