Thursday , September 19 2024

Which of the following lines properly starts a function using two parameters, both with zeroed default values?

Questions BankCategory: Python Essentials 1Which of the following lines properly starts a function using two parameters, both with zeroed default values?
Which of the following lines properly starts a function using two parameters, both with zeroed default values?

  • fun fun(a, b=0):
  • def fun(a=b=0):
  • fun fun(a=0, b):
  • def fun(a=0, b=0):

Explanation: The correct way to define parameters with default values is to state the name of the variable, the assignment sign (=), and the default value, e.g. a=0. If there are more default values, separate them with commas.

More Questions: Python Essentials 1 – Module 4 Test