On Fri, Sep 5, 2014 at 11:44 AM, Seymore4Head <Seymore4Head@hotmail.invalid> wrote: > BTW since I am getting no grade, I much prefer the answer than a hint. > The best hint IMO is to tell me how you would do it.
from math import ceil, sqrt def is_prime(n): if n < 2: return False if n % 2 == 0: return n == 2 return all(n % x != 0 for x in range(3, int(sqrt(n)) + 1, 2)) while True: n = int(input("Enter a number: ")) if is_prime(n): print("{} is prime.".format(n)) else: print("{} is not prime.".format(n)) -- https://mail.python.org/mailman/listinfo/python-list