Notes · Class 11 · CBSE · Science Computer Science
Lists notes
Revision notes for the chapter: the key points, definitions and exam tips to remember.
A list is an ordered, mutable collection of items in square brackets.
BASICS
- L = [1, "a", 3.5]; can hold mixed types and nested lists.
- Indexing and slicing like strings; lists can be changed: L[0] = 10.
OPERATIONS
- Concatenation (+), repetition (*), membership (in), slicing.
- Traversal: for x in L.
METHODS
- append(x), extend(list), insert(i, x).
- remove(x), pop(i), del L[i], clear().
- index(x), count(x).
- sort(), reverse(); sorted(L) returns a new list.
- len(), min(), max(), sum().
COPYING
- L2 = L1 only creates another name (both change together).
- Use L1.copy(), list(L1) or L1[:] for a real copy.
PASSING TO FUNCTIONS
- Lists are mutable, so changes inside a function affect the original.
Memory hook: "Lists change, strings don't."
Lists: practice questionsLists cheat sheet
More Class 11 · CBSE · Science Computer Science notes
Practise Lists
Sign up free to practise the full chapter after revising. Questions you get wrong come back until you've mastered them.
Start practising freeFree to start · No credit card needed