NZEC in python|NoSuchElementException in java|every beginner's issue resolved

I decided to write a blog about this,because I’m daily replying to many users same thing about custom input process on codechef.
I have seen each time a new user submits his first ever code on codechef(This is happening a lot as many new users are joining codechef nowadays), he first tries to “RUN” instead of “SUBMIT” the code, but doesn’t give the custom input, because he thinks ,if he will click run, it will check for the sample input( as this happens on some other online judge like hackerrank,hackerearth etc).
But in codechef ide, you have to give the custome input manually before clicking on “RUN”.
If not then the program will not find any input, hence it will cause NZEC error in python and NoSuchElementFound error in java.
So, either give custome input when clicking on RUN or just click on SUBMIT, if you don’t give custom input.

6 Likes

thank you so much for your answer.It helped me.But I am getting the same error in codevita too.please give me some suggestion.My code is working in jupyter but it is not working in codevita,It is throwing a run time error.

What error exactly you are getting in codevita?

def num(wrk,i,s):
c=0
for j in range(i):
if(s[j]==wrk):
c=c+1
print©
length_of_string=int(input())
s=input()
no_of_query=int(input())
query_list=[]
for i in range (no_of_query):
li1=int(input())
query_list.append(li1-1)
for i in query_list:
wrk=s[i]
num(wrk,i,s)

this is my code and I am getting a run time error.

kindly thanking for your information. :slight_smile:

but I am giving sample inputs they are passsing in java but on submitting ,it’s giving wrong answer.why is it so(Also I am using scanner))???