Skip to content
CodeKruPro

Positional-only (/) and keyword-only (*) parameters

QuizMediumPython only

In a function definition, / means the parameters before it must be passed by position, and * means the parameters after it must be passed by name. Given def pos(a, b, /, c, *, d): return a + b + c + d, which calls work? Pick all that apply.

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

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in