Skip to main content
← CoursesSenior Deep-DivesModule 0 · Before you startPrerequisites — what you should know before this trackpredict1 / 101
💬 Discuss🧪 Playground+25 XP
Task
📝 **Task:** Read the snippet below. Predict the **exact output** (one line). This exercises the senior-grade pattern this track opens with — Python's reference semantics on mutable defaults / shared lists. If you can predict this, you're ready for sr-01 (the GIL deep-dive). If you can't, FastAPI + Project Studio first. 📋 Implement the function above. Tests run automatically. 💡 **Hint:** Re-read the theory if you get stuck.

Keep going

🔮 Predict the output

Read the code carefully

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

a = add_item("x")
b = add_item("y")
print(a)
print(b)
print(a is b)

What will the program print? Write here:

📣 Help someone learn PythonShare this lesson with a friend — the first 15 are free, no signup.Tweet

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…