[N00B] What's %?
Robert Kern
rkern at ucsd.edu
Fri Feb 11 04:57:57 EST 2005
administrata wrote:
> sry, i don't know much about maths
>
> What is % used for?
>
> such as?
Among many other things, you can use it to test whether one integer
evenly divides another integer.
For example, to test if a number is odd:
def isodd(x):
return bool(x % 2)
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list