Hello,
I tried it with this simple programm def is_prime(n): x=2 while x <= int(n**0.5)+1: if n % x == 0: return False x=x+1; return True x=is_prime(7) if x==True: print 7, "is een prime getal" else : print 7, "is geen prime getal" But this one gets in a indefinitive loop. Roelof > From: st...@pearwood.info > To: tutor@python.org > Date: Sun, 22 Aug 2010 02:49:26 +1000 > Subject: Re: [Tutor] prime test problem > > On Sun, 22 Aug 2010 12:41:03 am Roelof Wobben wrote: > > Hello, > > > > I know. > > I have read them all I believe > > You've read all 64 million pages that Google finds? Wow, you must be a > fast reader! Well done! > > > but I can't see how I can convert the > > algebra to a working programm. > > Have you *tried*? > > Perhaps you should try something a little bit less ambitious. Write a > program to test whether a number is divisible by 3. Then write a > program to test whether a number is divisible by 3 or 5. Then write a > third program to test whether a number is divisible by 3, 5 or 7. > > Then generalise that third program. > > Off you go. Come back when you have some code. Even if it isn't working > code, at least try something. > > > > -- > Steven D'Aprano > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor