The quiz where the difficulty automagically adapts to the player's Python knowledge
This is a question page. You can use this page to bookmark a question. Start a new quiz!
def foo(a=): a.append(5) return a foo() foo() foo()
The list keeps getting longer and longer. The function keeps using the same object a as a default argument. The first time the function is executed, a does not exist: it is created as an empty list. The second time the function is executed, a already exists: 5 is appended to it. (effbot.org/zone/default-values.htm)
Question difficulty: 🔵🔵🔵🔵🔵