Question 517: What is the output of the following Python code?def mystery_function(x): return x if x > 0 else mystery_function(-x) result = mystery_function(-5) print(result)
tcs
wipro
infosys
general
aptitude
tricky-questions
python-programming
Themystery_functionrecursively calls itself with the absolute value of the input until the input is greater than 0. Therefore,mystery_function(-5)returnsmystery_function(5), resulting in the output 5.