DS160123 What is the output of this code?

Date:- 22/02/2023
Def func(val1, val2=2,val3=7, val4=1):
return val1val2val3
print(func(val2=2,val1=2,val3=4)
A) 256 (B) 32768 (C) 65536 (D) This code raises anexception

1 Like

def func(val1, val2=2, val3=7, val4=1):
return val1 val2val3 // indentation space(leave tab space)
print(func(val2=2, val1=2, val3=4))

the output of the above code will be

65536

  • the above code returns the exponential value of the function .
  • Option C is the correct answer.

@DS_TA
The answer should be 256 if function is returning val1**val2**val3,
as val1 = 2,val2=2,val3=4
so 2**2**4 = 2**8 or 4**4 = 256