I'm following the edx.org course: 6.00x "Introduction to Computer Science and Programming" and it's doing my head in. It's confronting to see how little maths I remember from school. There was an exercise this week containing the line "if count % 2 == 0:" and it took me three days to figure out what the % is meant to do.
I mainly got it when I started using pen and paper for calculating a division sum. I grew up with long division but I read that it's become an historical artifact. Division by hand gets taught in the short division way these days. I don't know how else you'd picture a remainder, but for the long division method though.
Troubleshooting the line of code I first used the Python interpreter, then a calculator, then the WWW. None alone worked for me. Python returned a number rounded off, the calculator returned a decimal number, and the explanations on the net were incomplete mostly because they assume the reader has a certain degree of understanding already.
In summary, 42 divided by 23 is 1.83 and in addition, 42 divided by 23 is 1-remainder-19. To untangle these two outcomes one uses the / sign for the one and the % sign for the other situation. In Python it likes like this:
>>> 42 / 23
>>> 42.0 / 23.0
>>> 42 % 23
And fractions are not the same as a remainder :).