Thursday , September 19 2024

The following snippet: def func(a, b): return a ** a print(func(2))

Questions BankCategory: Python Essentials 1The following snippet: def func(a, b): return a ** a print(func(2))
The following snippet:

def func(a, b):
    return a ** a
 
 
print(func(2))
  • will return None
  • will output 4
  • will output 2
  • is erroneous

Explanation: The code snippet is erroneous because the function is invoked with one argument, but two are needed, since both parameters don’t have a predefined value.

More Questions: Python Essentials 1 – Module 4 Test