NZEC error in python

Can anyone help me find out why is there a NZEC error in this simple code? All codes I’m writing in python are having error.

t = input("")

def rever(a):
    add = 0
    while a!=0 :
        c = a%10
        add = add*10 + c
        a = a/10
    return add

while k<t :
    x = input("")
    y = input("")
    val = rever(x) + rever(y)
    k = k+1


    your code here


that should work

  1. You are not printing the output val anywhere.

2)Using Try catch is a bad practice and will give you WA if not NZEC. If x and y are both on the same line then do x,y= [int(u) for u in raw_input().strip().split()].If they are on different lines then Try replacing the input("") statement by input() or int(raw_input().strip())

I too am getting the NZEC error relentlessly, can someone please tell me what’s wrong with my code for this problem :

import sys
n, m = map(int,raw_input().split())
if n !=0:
if n>=m:
D = map(int,raw_input().split())
if len(D) == m:
A= list(range(1,(n+1)))
ToDo = set(A) - set(D)
ToDo = list(ToDo)
Chef = ToDo[::2]
Assistant = ToDo[1::2]

            print " ".join(map(str, Chef))
            print " ".join(map(str, Assistant))


You can have a look at my code in python it might help.
. Also I don’t know abt python 3+ bt can u once check using int(input())

1 Like