Newbie: req for a bit of tutorial type help.

Thomas A. Bryan tbryan at python.net
Sun Mar 12 05:11:06 EST 2000


Aesop wrote:
 
> What i need is something that will perform divisions of the
> prospective prime number, and report whether there is any "remainder". I.E
> the modulus operator of C.

Python's not like C.  Just fire up the interpreter and *try* it. :)

>>> 15 % 2
1
>>> 15 % 4
3
>>> 15 % 3
0

So for x and y where type(x) and type(y) are <type 'int'> and 
where y is nonzero, 

( y * ( x / y ) + x % y ) == x

always returns true.

---Tom



More information about the Python-list mailing list