Jensen's Device: Difference between revisions
Content added Content deleted
(→[[Jensen's Device#python]]: {{trans|ALGOL 60}}) |
(→{{header|Python}}: add comment) |
||
Line 209: | Line 209: | ||
return temp |
return temp |
||
# note the correspondence between the mathematical notation and the call to sum |
# note the correspondence between the mathematical notation and the call to sum |
||
# it's almost as good as sum(1/i for i in range(1,101)) |
|||
print (sum (i, 1, 100, lambda: 1.0/i.value))</python> |
print (sum (i, 1, 100, lambda: 1.0/i.value))</python> |
||
Output: 5.18737751764 |
Output: 5.18737751764 |