Harmonic series: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (Remove unwanted and unnecessary white space from task header. Makes it look like crap on mobile browsers.) |
(→{{header|Python}}: Functor law tweak to eliminate lambda) |
||
Line 877: | Line 877: | ||
from fractions import Fraction |
from fractions import Fraction |
||
from itertools import accumulate, count, islice |
from itertools import accumulate, count, islice |
||
from operator import add |
|||
Line 885: | Line 886: | ||
''' |
''' |
||
return accumulate( |
return accumulate( |
||
(1 / Fraction(x) for x in count(1)), |
|||
add |
|||
) |
) |
||