Python List Methods
Most list methods change the same list. append(x) adds one item at the end. extend(iterable) adds many. insert(i, x) puts x at index i. remove(value) deletes the first match. pop() takes the last (or pop(i) that index). clear() empties the list. sort() and reverse() edit in place.
append vs extend is the viva. names.append(["Neha"]) nests a list. names.extend(["Neha"]) adds the string Neha. sorted(names) returns a new list; names.sort() changes names. count(x) and index(x) only read. copy() is a shallow copy.
Python List Methods — output — [70, 80, 90] then 90. sort is in place. pop removes last.
index → 0 1 2 list → [Asha, Ravi, Neha]
append([1,2]) vs extend([1,2]).