[N00B] What's %?

Grant Edwards grante at visi.com
Thu Feb 10 12:45:37 EST 2005


On 2005-02-10, administrata <administrata at hotmail.com> wrote:

> I don't understand about % like...
>
> 107 % 4 = 3
> 7 % 3 = 1

It's the modulus operator.  It returns the remainder of integer
division.  As we used to say in second grade:

 4 goes into 107 26 times with 3 left over.

 3 goes into 4 2 times with 1 left over. 

-- 
Grant Edwards                   grante             Yow!  If I pull this SWITCH
                                  at               I'll be RITA HAYWORTH!! Or
                               visi.com            a SCIENTOLOGIST!



More information about the Python-list mailing list