🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Python Functions: all 15 questions

Quiz: Python Functions · Question 13 of 15

What does this print? (code)

What does this print?

def greet(name, msg="Hello"):
    return f"{msg}, {name}"
print(greet(msg="Hi", name="Neha"))
  1. A.Hello, Neha
  2. B.Neha, Hi
  3. C.Hi, Neha
  4. D.An error, the arguments are in the wrong order
Answer & explanation

Correct answer: Hi, Neha

Keyword arguments are matched by name, so their order does not matter.

Can you get the rest right without peeking?

Take the timed Quiz: Python Functions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →