← 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"))
- A.Hello, Neha
- B.Neha, Hi
- C.Hi, Neha
- 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 →