Hi,
I noticed that my HW8 didn't pass a "pattern cross" secret test and checking my code I've realised that it is due to a strange way of approximating numbers used by Python.
This is what I would expect by the round function:
>>> round(1.5)
2
>>> round(2.5)
3
>>> round(3.5)
4
>>> round(4.5)
5
and so on.
This is on the contrary what Python does:
>>> round(1.5)
2
>>> round(2.5)
2
>>> round(3.5)
4
>>> round(4.5)
4
and so on.
Making some research I found out that this way of approximating numbers is called convergent rounding, statistician's rounding, Dutch rounding, Gaussian rounding, odd–even rounding, or bankers' rounding.
I wanted to share this with you so that you'll not be fooled like I was. At least I learned something new!