[Edu-sig] the importance of divmod

michel paul mpaul213 at gmail.com
Thu Jan 13 07:16:52 CET 2011

I've been wondering if the Python divmod operator might point to a central
issue in math education.

Understanding ratio and difference is fundamental to understanding algebra.

With all the symbol manipulation we teach in our curriculum, I'm not sure
that most students really understand what ratios and differences are.

Or, maybe they do, but we don't do a good job showing how to connect them.
And we should, because understanding ratios of differences becomes calculus.

I was discussing with my class writing a function reverse(n) for some
natural number n that would reverse its digits (assuming base 10, but not
excluding others).

There are all kinds of ways to think about it.  One kid accidentally
discovered that s[::-1] reverses a string s.  He was trying to do a slice
and accidentally put in an extra colon.  He called me over and showed me
that it reversed the string of digits he had created from n.  That made me
have to look some stuff up.  Wow, what a cool idea!  You can step through a
slice, just like with range().

But then, what if we want to think about it in purely mathematical terms?
If we agree that, for whatever reason, we cannot convert to strings, how
might we think about reversing digits using purely functional reasoning,
just % and recursion?  That's how I initially presented it, and then a kid
suggested using divmod, and I was delighted.  It totally simplified the

I think it would be great to come up with a list of divmod math problems.
Anybody have some?  I think developing fluency in divmod sorts of reasoning
would do a whole lot of good for understanding ratio.  Our current state of
high school mathematical literacy that equates a rational number with some
bizarre decimal is horrible.

- Michel

"Computer science is the new mathematics."

-- Dr. Christos Papadimitriou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20110112/0bdb1a60/attachment.html>

More information about the Edu-sig mailing list