Skip to main content
🔮 Output PredictionPY Python Hard⚡+35 XP

Mutable Default Argument

What happens when we call this twice?

Python
def add_item(item, lst=[]):
    lst.append(item)
    return lst

print(add_item("a"))
print(add_item("b"))

🔮 What is the output?