List Copy in Python
Level 255 keystrokes
This creates a shallow copy of a list using the copy() method. Changes to the copy don't affect the original.
Python code
# Create a list with three numbers1original = [1, 2, 3]# copy() creates a new list with same elements# This is a shallow copy (nested objects are shared)2copy = original.copy()# Print the copied list3print(copy)Output
[1, 2, 3]
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
,× 2(× 2)× 2=× 2.× 1[× 1]× 1