3 ms·
> We can make it a bit more terse using list comprehensions: import functools as ft def fact(n): lst = range(1, n) return ft.reduce(lam
by hn92726819 11mo ago
> We can make it a bit more terse using list comprehensions:
import functools as ft
def fact(n):
lst = range(1, n)
return ft.reduce(lambda acc, x: acc*x, lst)
Amusing that there's not a list comprehension in sight.