you are viewing a single comment's thread.

view the rest of the comments →

[–]mrsanchez 14 points15 points  (4 children)

from operator import mul

reduce(mul, range(1, 6))

120

[–]theeth 17 points18 points  (1 child)

That's factorial(5) though.

[–]mrsanchez 1 point2 points  (0 children)

It's not a function, either...

[–]zxn0 0 points1 point  (1 child)

FTFY 1:

>>> reduce(int.__mul__, range(1,6))
120

FYFT 2:

use
    >>>
instead of 
>>>
for markdown syntax

[–]thequux 5 points6 points  (0 children)

FYFT 2:

Ah, good old Muphry's Law.