append() adds one element to the list β even if itβs another list.
filename.python
a.append([4, 5]) # adds as a single item
extend() adds each element from another iterable to the list.
filename.python
a.extend([4, 5]) # adds 4 and 5 separately
Challenge: I once used append() expecting list merging, but ended up with nested lists β fixed by using extend().
Limitation: extend() only works with iterables.
Alternative: += operator for similar behavior to extend.
