Hello, I am a rookie programmer and only recently started using CodeChef. I was testing out the CodeChef ide and realised that I got an error everytime i tried to take input on the Python ide. The error triggered for both the input() and raw_input() functions.If someone could suggest a fix or an alternative method of taking input, I’d appreciate it. My code:
x = input()
Error:
Traceback (most recent call last):
File “./prog.py”, line 2, in
EOFError: EOF when reading a line
EOF error results usually in an online judge like CodeChef when an input is given by the system but the input reading line is not at the right place to read it.
Read the sample input syntax again and try.
when i give the data in custom input , it execute the code without any error and give the right result , but on submitting the same code it gives the same error(runtime error
NZEC)
I just started codechef and I’m too getting that EOF error each time when the code is allowed to get compiled with system’s input.
For some programs i could find solution when custom input is provided.
and also you can better try : try … except …
^^ That’s my take on the BST operations challenge. When I run the code (without custom input), i get an empty input stream which returns “invalid literal for base 10”. But with custom input it runs perfectly. The same thing happens when I submit it. Is there something wrong with my code?
try this
x = input().split(’ ‘)
then x will be a list with every element as string
so you need to convert each element into int by type casting
example:
code:-
x = input().split(’ ')
print(x)
its working…bt it increased my code execution time by 5sec nd now it shows TLE(Time Limit exceeded) error.
Wanted to know what to do.
Is there any other way to handle this exception?