1 / 3
Oct 2016

I am a beginner. I do not understand the error, what does it mean NZEC?
def criba_eratostenes(n):
l=[]
multiplos = set()
for i in range(2, n+1):
if i not in multiplos:
l.append(i)
multiplos.update(range(i*i, n+1, i))
return l
n=int(input())
while n!=0:
a=input().split()
lista=criba_eratostenes(int(a[1]))
for k in lista:
if k>=int(a[0]):
print(k)
print()
n-=1

  • created

    Oct '16
  • last reply

    Aug '17
  • 2

    replies

  • 915

    views

  • 3

    users

Nzec means non zero error code. You can find more information in the www or in the FAQ. Most nzec I got at spoj for my python codes where caused by trying to access lists ore dicts using an invalid index or key.

Without seeing your complete code and without correct formatting I cannot analyze any further.

10 months later
#!/usr/bin/env python
import math
def isprime(n):
    return all([(n%j) for j in range(2, int(math.sqrt(n))+1)]) and n>1

num = raw_input().split()
if len(num) > 1:
    for i in range(int(num[0]),int(num[1])+1):
        if isprime(i):
            print i
else:
    if isprime(int(num[0])):
        print num[0]

Could not understand why it's going Wrong answer.