List Methods
list.copy()
Returns a distinct outer list containing the same element references in the same order. Changes to the new outer list do not modify the original outer list, but editing a shared nested object can affect both. This is a shallow copy, not recursive cloning. For ordinary lists, items[:] and list(items) are alternative shallow-copy forms.
Formal Syntax & Structure
python syntaxpython
items.copy()Return Value
list
A new shallow list containing the original element references.
Working Example
Example Snippetpython
original = [["pen"], ["book"]]clone = original.copy()clone.append(["bag"])clone[0].append("pencil")print(original)print(clone)print(clone is original)