Hi. can anyone point me into any directions why is this code getting runtime error NZEC?
Semms to run very ok on my machine, tried a lot of test cases and no problems.
This is my second problem, so i probably have a newbie problem.
#generate prime numbers
def primes(max):
primes = dict()
for i in range(2, max+1): primes[i] = True
for i in primes:
for f in range(i, max+1, i)[1:]:
primes[f] = False
return [i for i in primes if primes[i]==True]
count = int(raw_input())
list1 = []
list2 = []
if count <= 10:
for y in range(count):
raw=raw_input()
split1 = raw.split(" ")
list1.append(int(split1[0]))
list2.append(int(split1[1]))
print
min = min(list1)
max = max(list2)
result = primes(max)
for i in range(count):
for c in range(len(result)):
if result[c] >= list1[i] and result[c] <= list2[i]:
print result[c]
print
created
last reply
- 8
replies
- 473
views
- 2
users