Overview
List ordered collection hai, koi bhi type store kar sakti hai, mutable hai—modify ho sakti hai.
Analogy
List shopping list ki tarah hai: ordered, duplicates allowed, aasaani se add/remove.
Step-by-step
- Banao: my_list = [1, 2, 3]
- Access: my_list[0] returns 1
- Add: my_list.append(4)
- Delete: my_list.remove(2) ya my_list.pop()
Visual
nums = [10, 20, 30]
nums[0] → 10
nums[-1] → 30
nums[1:] → [20, 30]
Common mistakes
- Out of range access IndexError
- list.sort() (in-place) aur sorted(list) ka confusion
- List variable reference hai, assignment shallow copy hai
Practice questions
- reverse() ke bina list reverse karo
- List mein maximum aur second maximum nikalon