Search code examples
pythonpython-3.xruntime-errorpython-3.9

Runtime error in codeshef atm problem python


I wrote a solution for codechef's atm problem and got runtime error but in my computer it worked well.

Question - https://www.codechef.com/problems/HS08TEST/

My code

withdraw, balance = input().split()
print(balance if (int(withdraw)>=float(balance) or int(withdraw) %5 !=0) else float(balance) - int(withdraw) - 0.50 )

Error

NZEC
Traceback (most recent call last):
  File "./prog.py", line 1, in <module>
EOFError: EOF when reading a line


Solution

  • According to this thread, you need to provide custom input when clicking 'run'. The test cases will only be run when you click 'submit'.

    https://discuss.codechef.com/t/python-error-while-taking-input/21416

    From the thread:

    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.