The following snippet:
def func_1(a): return a ** a def func_2(a): return func_1(a) * func_1(a) print(func_2(2))
- is erroneous
- will output 2
- will output 16
- will output 4
Explanation: Let’s analyze the code:
- the func_2 function is invoked with the integer 2 as its argument,
- the func_2 function returns the product of func_1(2) * func_1(2)
- the func_1 function is invoked twice with an integer argument of 2,
- the func_1 function returns 2*2, which is 4,
- the func_2 function returns the product of 4 * 4, which is 16,
- the result is printed on the console.
More Questions: Python Essentials 1 – Module 4 Test
Please login or Register to submit your answer