Oct 25, 2024
+ operator is used for concatenation.'abc' + 'def' results in 'abcdef'.[a, b] + [c, d] results in [a, b, c, d].alist + [5] (not alist + 5).Creating Lists:
[ ][ ]C = A + BAppending Elements:
C + ['d'] creates a new list with 'd' appended.Variable Reference: Multiple variables can reference the same list.
D = C (C and D reference the same list).Effect of Modifications:
C = C + ['7'], C changes but D still references the original list.