1

i'm new to python.i have been getting NZEC run time error for this code in codechef. i changed input() to raw_input().can someone explain to me why my code is getting a NZEC error

def function1(list1,sum):
if len(list1)==1:
    return sum
m=min(list1)
i=list1.index(m)
if list1.count(m)>1:
    sum+=list1.count(m)
else:
    sum+=1
list1=list1[:i]
return function1(list1,sum)

t=int(raw_input())
global list1
global sum
while t>0:
  n=int(raw_input())

  sum=0
  list1=list()
  list1[1:n]=raw_input().split()
  m=min(list1)
  i=list1.index(m)
  if i==0:
    if list1.count(m)>1:
        sum+=list1.count(m)
    else:
        sum+=1
    print(sum)
else:
    k=function1(list1,sum)
    k+=1
    print(k)
t-=1
bakarin
  • 622
  • 5
  • 17

2 Answers2

0

You can do this this is solve my error.

put your all code in try and expect block.

This is solve my error.

try:
     ***your code***
 except:
        pass
  • Hiding all errors and letting the code exit in an unknown state without showing that something wrong happened is **never** a good solution. It's just the worst thing to do! – Thierry Lathuille Jul 20 '19 at 06:06
0

(NZEC) I think you can't put custom input value in blank?

  1. Ple click on custom input button check tick...

  2. And write down some custom value on it in blank ... for test case

  3. after you click to run...

jai_kumar
  • 31
  • 2
  • 14