[Tutor] (no subject)

alan.gauld@bt.com alan.gauld@bt.com
Thu, 16 Sep 1999 10:18:41 +0100


>     ...     for x in range(2, n):
>     ...         if n % x == 0:( I don't understand the n%x 

It means find the remainder of an integer division.

Thus 7 divided by 3 is 2 remainder 1
So,
7/3 => 2
7%3 => 1

Thus 
   n%x == 0 
is true when the number held in n is exactlty 
divisible by the number in x.
And thus n cannot be a prime number...

Alan G.