on writing a while loop for rolling two dice

Hope Rouselle hrouselle at jevedi.com
Sun Sep 19 11:31:50 EDT 2021


dn <PythonList at DancesWithMice.info> writes:

[...]

> Further, if you look at the OP's original solution, it only publishes
> the last pair, ie the match, without mention of the list of non-matches.
> Was it perhaps only a means of testing the solution?

It was a means of showing the student that indeed they obtained a match.
If the exercise asked for returning a single die or no die at all, they
would make mistakes and there'd be no sign of them being wrong.  For
instance, one trouble a lot of them went through was to start counting
from zero and so their number of rolls was off by one.  (I didn't see
that coming!)  The reason they fall for this is that they also test
little --- for some it never occurred a match on the first roll, so they
never saw the zero counter coming out.


More information about the Python-list mailing list