[Tutor] Making a Primary Number List generator

Alan Gauld alan.gauld at btinternet.com
Tue May 14 10:22:55 CEST 2013


On 14/05/13 02:37, Dave Angel wrote:

>> def counting_primes():
>>     primelist = []
>>     for prime in range(2,1000):
>>        if isprime(prime):
>>           primelist.append(prime)
>>     return primelist
>
> Actually no, since the OP's looking for the first 1000 primes not for
> all the primes under 1000.

Ah yes, I forgot that and didn't read the code properly, sorry.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list