[Tutor] Making a Primary Number List generator
Dave Angel
davea at davea.name
Tue May 14 03:37:09 CEST 2013
On 05/13/2013 07:55 PM, Alan Gauld wrote:
> On 14/05/13 00:01, Daniel Magruder wrote:
>
>> <SNIP>
>
>
>
> That seems OK but it would be simpler with a for loop:
>
> 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.
--
DaveA
More information about the Tutor
mailing list