Getting NZEC error for simple line input

I’m getting the NZEC error for the simple input statement. As I’m new to the codechef and also python, please guide me.
T = int(input())

I’m getting this error:

Traceback (most recent call last):
File “./prog.py”, line 1, in
EOFError: EOF when reading a line

Thanks and Regards,
POP

where is the code?

In codechef you have to provide input then click run.

#hackraj I have just typed.
T = int(input())

for this also it says NZEC error, and if I try to keep try - except block, the try block is not running.

I tried to solve this problem - “https://www.codechef.com/problems/XYSTR

my code is:

T = int(input())

for i in range(T):
s = input()
c_x = 0
c_y = 0
for i in range(len(s)):
if s[i] == ‘x’:
c_x += 1
elif s[i] == ‘y’:
c_y += 1
print(min(c_x,c_y))

I’m always getting,
NZEC

Traceback (most recent call last):
** File “./prog.py”, line 1, in **
EOFError: EOF when reading a line

In for loop in both the places you are using i
for i in range(T) and again for i in range(len(s))
so just change i to J :- for j in range(T)

  1. Follow @hackraj comment, you might face unexpected behaviour because of this.
  2. Are you providing input to CODECHEF IDE, because you need to know that CODECHEF IDE doesn’t provide input on it’s own for the question in the IDE as what hackerrank does.
  3. If you solve first two problems there are high chances your code might give WA because that shouldn’t be the logic for the question.
    For eg.
    xxxxyyyy
    Correct ans is 1, your code might give 4, check for it.
  4. Keep trying :smiley::smiley:
1 Like

Thank you very much.

Thank You very much.

you have to provide the input to codechef by clicking on custom input and copy paste all the inputs to the box provided

Thank You

welcome