Output: function with a list default argument, called three times appending a value
EasyP1Output
What does this Python code print?
1def add(item, items=[]):2 items.append(item)3 return items45print(add(1))6print(add(2))7print(add(3, []))8print(add(4))
Saved automatically
One line per print, as Python prints it. An uncaught exception as its last traceback line, for example ZeroDivisionError: division by zero.
Hints
Saved automatically