Skip to main content
← CoursesPython FoundationsModule 2 · Data structuresPredict the conclusionpredict18 / 170
💬 Discuss🧪 Playground+75 XP
Task
📝 **Task:** Predict the output of a reference-sharing program. ```python a = [1, 2, 3] b = a b.append(4) print(a) ``` 📋 Type the list you expect into the output box. 💡 **Hint:** `b = a` does NOT copy the list — both variables point to the SAME list in memory. Changes through `b` are visible through `a`. 🎯 Think: what does `a` look like after `b.append(4)`?

Keep going

🔮 Predict the output

Read the code carefully

a = [1, 2, 3]
b = a
b.append(4)
print(a)

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…