Python append() vs extend(): Key Difference

Python Clarity Series – Episode 6 Topic: = append() vs extend() List methods confusion: append() vs extend() Students think both do the same thing. They don’t. 👉 append() → Adds ONE item 👉 extend() → Adds EACH element separately Example: a = [1, 2] a.append([3, 4]) print(a) Output: [1, 2, [3, 4]] Now: a = [1, 2] a.extend([3, 4]) print(a) Output: [1, 2, 3, 4] 💡 Memory Trick: append → Attach extend → Expand Exams love this difference. Students — which one did you mix up first time? #PythonBasics #CBSE #CodingMistakes #LearnPython

  • diagram, engineering drawing

To view or add a comment, sign in

Explore content categories