What is the output of the following Python code snippet?
def fact(n):
return 1 if n
Correct answer
B. 120
5 views
B. 120
5 views
A recursive function calls itself; 5! = 120.
Asked in: Python Interview Functions
https://docs.python.org/3/tutorial/controlflow.html#defining-functionsNot sure why the answer is B? Ask here and get an explanation.