KnowledgeBoat Logo

Computer Science

Which of the following function calls can be used to invoke the below function definition ?
def test(a, b, c, d)

  1. test(1, 2, 3, 4)
  2. test(a = 1, 2, 3, 4)
  3. test(a = 1, b = 2, c = 3, 4)
  4. test(a = 1, b = 2, c = 3, d = 4)

Python Functions

2 Likes

Answer

test(1, 2, 3, 4)
test(a = 1, b = 2, c = 3, d = 4)

Reason —

  1. The function call test(1, 2, 3, 4) passes four positional arguments 1, 2, 3, and 4 to the function.
  2. The function call test(a = 1, b = 2, c = 3, d = 4) passes four keyword arguments, explicitly stating the parameter names (a, b, c, d) and their corresponding values.

Answered By

1 Like


Related Questions