Python NZEC Runtime Error

I tried with the raw_input too… but not working …

test_case = input()
num = []
for i in range(test_case):
num.append(raw_input())

for i in num:
print next_palidro(i)

2 Likes

use:
temp = input()
a,b = temp.split(" ")
this will solve your problem as the first line of input i.e e.g if the input is 10 4
using a = input() will take the entire line as a string and not leave anything for b to take in input nad hence the problem

Hey I’m facing the same problem
My Code:
temp=input()
print(temp)
I’m using Python 3.6 still I’m getting NZEC. What should I do?

1 Like

Facing same issue in python 3.6 :
notc=input()
print(notc)
getting NZEC for above lines, really frustrating

I am also getting NZEC error when i am running below code.

num=[6,2,5,5,4,5,6,3,7,6]
t=int(input())
for i in range(t):
a,b=map(int,input().split())
c=a+b
count=0
while(c!=0):
rem=c%10
c/=10
count+=num[rem]
if(i!=n-1):
print(count)
else:
print(count,end=’’)

Can anyone please help me in correcting this error.

Please share your solution link or format your code correctly.
Use three backticks ``` before and after your code.

Example:

```
Code
```

Then it looks like:

num=[6,2,5,5,4,5,6,3,7,6]
t=int(input())
for i in range(t):
  a,b=map(int,input().split())
  c=a+b
1 Like

@ankitsinla In your code, you use undefined variable n
if(i != n - 1):

Hey I’m getting NZEC error in fir line i.e T=int(input())
Please Help

    T = int(input())
while T:
    T-=1
    N,M = map(int, input().strip().split(" "))
    f = list(map(int,input().strip().split(" ")))
    p = list(map(int,input().strip().split(" ")))
    arr = [0]*M
    for i in range(0,N):
        arr[f[i]] = arr[f[i]] + p[i]
    
    arr.sort()
    for j in arr:
        if j != 0:
            print(j,end="")
            break

Have you provided custom input?

1 Like

It is happened because you probably didn’t use custom input while compile.

Thank you, this helped me.

I am getting NZEC for the following code at line 1.

inp = input()
inp = input().split(' ')
withdraw_amt, bal = float(inp[0]), float(inp[1])
if withdraw_amt%5 == 0 and withdraw_amt<bal:
    bal-=withdraw_amt+0.50
print('{:.2f}'.format(bal))

The complete error is:

Traceback (most recent call last):
File "./prog.py", line 1, in <module>
EOFError: EOF when reading a line

Are you trying to “Run” without Providing “Custom Input”?

CodeChef: Practical coding for everyone can someone tell me why i am getting nzec error in this code

CodeChef: Practical coding for everyone can someone tell me why i am getting nzec error in this code.

even I am getting a run time error though i have selected custom input with the same code

Are you trying to “Run” without Providing “Custom Input”

1 Like

def mutliptle_of_3(testcase):
no_of_digit, d_1, d_2 = testcase
d_3 = (d_1 + d_2) % 10
d_4 = (d_1 + d_2 + d_3) % 10

pattern = {8 : 6, 6: 2, 2: 4, 4: 8}
total_sum = 0

if no_of_digit <=4 :
    if no_of_digit == 2:
        total_sum =  d_1 + d_2 
    elif no_of_digit == 3:
        total_sum =  d_1 + d_2 + d_3
    elif no_of_digit == 4:
        total_sum =  d_1 + d_2 + d_3 + d_4
else:
    initial_sum  = d_1 + d_2 + d_3 + d_4
    pattern_starting = initial_sum % 10
    
    digit_in_pattern = no_of_digit - 4
    occurence_of_pattern = digit_in_pattern // 4
    
    incomplete_pattern = digit_in_pattern % 4
    digit = pattern_starting
    incomplete_pattern_sum = 0
    for _ in range(incomplete_pattern):
        incomplete_pattern_sum += digit
        digit = pattern[digit]

    total_sum = initial_sum + incomplete_pattern_sum + occurence_of_pattern * 20

if total_sum % 3 == 0:
    return "YES"
else:
    return "NO"

if name == “main”:
testcases = []
for _ in range(int(input())):
testcases.append(tuple(map(int, input().split())))

for testcase in testcases:
    print(mutliptle_of_3(testcase))

Getting Runtime Error NZEC

Consider the test input:

1                                                                                                                                              
10 1 4