Overview
List Python ka sabse flexible data structure hai — ordered, mutable, aur mixed types allow karta hai.
Analogy
List ek numbered dabba hai — pehle dabbon mein pehli cheez, aur easily add/remove kar sakte ho.
Step-by-step
- Square brackets mein items daalo: [1, 2, 3]
- Index se access karo: list[0] pehla element
- append() se end mein add karo
- remove() ya pop() se delete karo
Visual
fruits = ["apple", "banana", "cherry"]
fruits[0] # "apple"
fruits[-1] # "cherry"
fruits[1:3] # ["banana", "cherry"]
Common mistakes
- Index 0 se shuru hota hai, 1 se nahi
- Negative index — -1 last element hai
- Slice end exclusive hai: [1:3] mein index 3 nahi aata
Practice questions
- Shopping list banao aur items add/remove karo
- List ko reverse karo bina built-in use kiye