Which programming language is this?
def factorial(n):
return 1 if n == 0 else n * factorial(n - 1)
Answer: Python
The 'x if cond else y' conditional expression is Python's ternary.
Play Programming Languages ▸
def factorial(n):
return 1 if n == 0 else n * factorial(n - 1)
Answer: Python