Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
Kilimanjaro
15y ago
0 comments
Save
Share
Which I guess can be written like
def fact(n): return 1 if n<=1 else n*fact(n-1)
0 comments
2 comments · 2 top-level
top
newest
oldest
danio
15y ago
unfortunately not on python 2.4, which is the version we have on our production servers (2 yr old Linux)
Kilimanjaro
OP
15y ago
One liner
def fact(n): return n*fact(n-1) if n>1 else 1
j
/
k
navigate · click thread line to collapse