# [Tutor] Finding prime numbers

Boykie Mackay boykie.mackay at gmail.com
Wed Sep 19 19:08:33 CEST 2007

```Thanks.That's solved!

On Wed, 2007-09-19 at 13:01 -0400,
christopher.henk at allisontransmission.com wrote:
>
>
> tutor-bounces at python.org wrote on 09/19/2007 12:38:49 PM:
>
> >
> > I have posted the code below:
> >
> > #!/usr/bin/env python
> >
> > '''A program to generate prime numbers when given 2 numbers'''
> >
> > def isPrime(number):
> >     number=abs(int(number))
> >     #1 is not considered a prime number
> >     if number<2:
> >         return False
> >     #2 is the only even prime number
> >     if number==2:
> >         return True
> >     #no even prime numbers after 2
> >     if not number&1:
> >         return False
> >     #to find all prime numbers we need to go up to the
> >     #square root of the highest odd number
> >     for x in range(3,int(number**0.5)+1,2):
> >         if number%x==0:
> >             return False
> >         return True
>
> Looks like you want to move the return True out one level of
> indentation.
>
> > > --
> > > Michael Langford
> > > Phone: 404-386-0495
> > > Consulting: http://www.TierOneDesign.com/
> > > Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
>
> Chris Henk
> Allison Transmission
> phone:  317.242.2569
> fax:  317.242.3469
> e-mail:  christopher.henk at allisontransmission.com

```