-
Notifications
You must be signed in to change notification settings - Fork 695
Open
Description
import copy
original_list = [1, 2, [3, 4]]
Shallow copy example
shallow_copied_list = copy.copy(original_list)
shallow_copied_list[2][0] = 99
print(f"Shallow copy result: {original_list}") # Output: [1, 2, [99, 4]]
Deep copy example
deep_copied_list = copy.deepcopy(original_list)
deep_copied_list[2][0] = 55 # Change to a different value for clarity
print(f"Deep copy result: {original_list}") # Output: [1, 2, [3, 4]]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels