NZEC error in Python 3

Why my code is showing such an error? I am unable to understand the issue!! Please help!

Here is my code:

def check_fair(l):
    if len(set(l[:3])) == len(set(l[3:])):
        for i in range(3):
            if l[:3].index(min(l[:3])) == l[3:].index(min(l[3:])):
                l[:3].pop(l[:3].index(min(l[:3])))
                l[3:].pop(l[3:].index(min(l[3:])))
            else:
                return "NOT FAIR"
            return "FAIR"
    else:
        return "NOT FAIR"

check = list()
for i in range(int(input())):
    l = list(map(int, input().split()))
    check.append(check_fair(l))
print(*check, sep="\n")

Did you click “Run” without providing Custom Input? It’s hard to tell from the (cropped) screenshot.

1 Like

[https://www.google.com/amp/s/www.geeksforgeeks.org/nzec-error-python/amp/](Check this… )

Yes, I did click “Run”, not providing any custom input !!!

I have read that already, but as you read the article, there can be various reasons for such an error.
What mistake have I done here?? I am unable to identify that !!!

If you don’t provide custom input, then there’s no input to read, hence your error :slight_smile:

2 Likes

So, you mean that on CodeChef we always need to provide custom inputs here in online IDE, for checking our results before submitting ?

Yes - it seems to trip up pretty much everyone at some point! :slight_smile:

On Hackerrank it’s different - if you click “Run” without custom input, then it runs your code with the sample testcases as input. Not here on Codechef, though :slight_smile:

2 Likes

Oh! ok got it. Thanks a lot for the help. :blush::+1::+1:

1 Like