Here's the key:
$ python2
Python 2.7.10 ...
>>> 1/2
0
>>>
$ python
Python 3.5.1 ...
>>> 1/2
0.5
>>> 1//2
0
>>>
I read about this awhile ago, but it's not until it bites you that you remember
fully.
--
https://mail.python.org/mailman/listinfo/python-list
I was being facetious, but behind it is a serious point. Neither the APL nor
the J languages use precedence even though their inventor, Ken Iverson, was a
mathematician.
That was to support functional programming dating back to the 1970's.
However, precedence wasn't the problem in this case, i
Yes, I just worked that out. It's the integer math that's the problem.
I guess this has been fixed in python 3, but unfortunately it seems that most
people are still using python 2.
Thanks for all the help!
--
https://mail.python.org/mailman/listinfo/python-list
Precedence, d'oh!
rs *= (n-(i-1))/i
is equivalent to:
rs = rs * ((n-(i-1))/i)
not
rs = rs * (n-(i-1))/i
which is the same as
rs = ( rs * (n-(i-1)) ) /i
Ken Iverson was right. Precedence is a bad idea.
--
https://mail.python.org/mailman/listinfo/python