๐ฎ 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 happens when we call this twice?
def add_item(item, lst=[]):
lst.append(item)
return lst
print(add_item("a"))
print(add_item("b"))