Price fraction: Difference between revisions
Content added Content deleted
(→{{header|Mercury}}: add implementation) |
(→{{header|Python}}: Whoops!) |
||
Line 1,392: | Line 1,392: | ||
<lang python>>>> import bisect |
<lang python>>>> import bisect |
||
>>> _cin = [ 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96, 101] |
>>> _cin = [ 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76, 81, 86, 91, 96, 101] |
||
>>> _cout = [10, 18, 26, 32, 38, 44, 50, 54, |
>>> _cout = [10, 18, 26, 32, 38, 44, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 100] |
||
>>> def centsrounder(centsin): |
>>> def centsrounder(centsin): |
||
return _cout[ bisect.bisect_right(_cin, centsin) ]</lang> |
return _cout[ bisect.bisect_right(_cin, centsin) ]</lang> |