Python NZEC Runtime Error

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