> I am trying to write a program that will figure out if a number is prime > or not. Currently this is the code that I have: > > import math > > def main(): > > number=input("Please enter a positive whole number greater than 2: ") > for value in range(2, number-math.sqrt): > if number % value == 0: > print number, "is not prime" > exit > print number, "is prime" > > main()
I am a beginner so, I hope what I give, makes sense. In it's simplest form what is wrong with :- n = input("Enter a number") if n % 2 != 0 and n % 3 != 0: print n, " Is a prime number" Comments please. Norman _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor