#8 most askedVery commonEasyFunctions
*args and **kwargs
New to Functions? Learn it from scratch firstFunctions & the Call Stack โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.What do *args and **kwargs mean, in a function definition and in a call? Predict the output.
๐ฎ Predict the output
def show(first, *args, sep="-", **kwargs):
print(first, args, sep, kwargs)
show(1, 2, 3, sep="+", color="red")
opts = {"sep": "/", "x": 1}
show(*[9, 8], **opts)
๐ค Answer it out loud, then check yourself
Say your answer as if the interviewer is listening (30โ90 seconds). Then reveal what a strong answer covers and tick what you said.
Answer out loud first, then compare.
Want to rehearse it?Answer this to the AI interviewer and get a verdict โ