Sorry about that.

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

if __name__=='__main__':
    startNum=int(raw_input())
    endNum=int(raw_input())
    for num in range(startNum,endNum):
        check=isPrime(num)
        if check==True:
            print num,
            

On Wed, 2007-09-19 at 12:31 -0400, Michael Langford wrote:
> Attachments are a bad thing to send to open mailing lists in general.
> 
> In your case, the list appears to have filtered off the code. Please
> paste it in inline.
> 
>           --Michael
> 
> On 9/19/07, Boykie Mackay <[EMAIL PROTECTED]> wrote:
>         Hi Guys,
>         
>         Could you please look over my code 'attached' to find and
>         print out
>         prime numbers between to given values.When run it it is
>         showing
>         inaccuracies i.e printing out '49' and '95' as prime numbers. 
>         
>         I have been through the code but can't seem to find where I
>         may have
>         gone wrong.I am sure it has to do with the algorithm to find
>         the prime
>         numbers as the function fails it's unit test.Any help or links
>         would be 
>         much appreciated.
>         
>         Thanks,
>         
>         Boyks
>         
>         _______________________________________________
>         Tutor maillist  -  Tutor@python.org
>         http://mail.python.org/mailman/listinfo/tutor
> 
> 
> 
> -- 
> Michael Langford
> Phone: 404-386-0495
> Consulting: http://www.TierOneDesign.com/
> Entertaining: http://www.ThisIsYourCruiseDirectorSpeaking.com

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to