[SciPy-user] prime numbers
Gael Varoquaux
gael.varoquaux at normalesup.org
Thu Oct 23 09:34:11 EDT 2008
On Thu, Oct 23, 2008 at 02:28:40PM +0200, Walter Mudzimbabwe wrote:
> can anybody help me figure out why the following program cannot produce
> primes upto 10.
I haven't spent more the a few seconds looking at that (little time), but
my guess is:
> --------------------------------------------------
> from scipy import *
> def isdivisible(n,listt):
> for i in range(len(listt)):
> if (n%listt[i]==0):
> return 1
> else:
> return 0
"else: ..." should be indented as the "for", not as the "if".
Gaël
More information about the SciPy-User
mailing list