KnowledgeBoat Logo

Computer Science

Which of the following function calls will cause Error while invoking 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

1 Like

Answer

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

Reason — In both of these function call test(a = 1, 2, 3, 4) and test(a = 1, b = 2, c = 3, 4), the syntax is incorrect because when using keyword arguments, all arguments following the first one must also be specified with keyword arguments.

Answered By

2 Likes


Related Questions