Python code throwing runtime error on including an import statement.

While solving Many Left when I was trying to import “random” in my python code, judge was showing a runtime error. I believe its because my code has thrown some exception to the judge. In one of my successful submissions I just included the import random statement, and didn’t use it anywhere, still I got the same runtime error. Can anyone please tell me what can be the possible reason? Am I missing something here? I couldn’t find any thing in wiki related to it. One difference that I can see is, I’m using python 3.3.0 and judge has python 3.1.2. Not sure if its because of that.

Links to my submission:

One which was accepted:

One resulted in runtime error:

1 Like

Apparentely, the random module has some trouble when it comes to compatibility between different python versions, as stated here:

However, I still don’t understand why is your code producing NZEC status as you just added a new line without changing nothing else about the code…

Maybe during the execution of the import, the code will generate something “on the back” that causes this error… But maybe someone else with more expertise can help you out on this matter… :wink:


1 Like

@kuruma: Thanks for the response. I’ll wait for some expert to give his opinion here.

maybe the random module is not available in the codechef Python3 environment.

i mean, maybe it has been “made” unavailable for specific reasons.

Python2: (WA)

Python3: (RE)


@cyberax: Thanks. Yes it can be a possible reason. Can anyone from Codechef confirm this behavior??