>     1.  What is 'exit'?
instead of exit I can use break so that the loop will stop executing

>     2.  What is 'number - math.sqrt'?
for math.sqrt I could use math.sqrt(n) so that it would take the sqrt of n
which is entered in by the user


However for the output I am still receiving

enter a number greater than 2: 49
49 is prime
49 is prime
49 is prime
49 is prime
49 is prime
49 is not prime

The problem is using break just breaks from the loop and then goes into the next instruction being
print number, "is prime"
As Danny suggested before using return will stop the entire function rather than the just the loop.


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

Reply via email to