The program below is finding prime numbers in a given range. for the noprimes list comprehension part, why do we have 3 parameters in range?
noprimes = [j for i in range(2, 8) for j in range(i*2, 50, i)]
primes = [x for x in range(2, 50) if x not in noprimes]
print prime
and what is i doing there?
See the docs:
When comparing it to a
for(..; ..; ..)loop e.g. in C the three arguments are used like this:There are also good examples in the docs: