how to create a copy of a list python code example
Example 1: copy a list python
new_list = old_list.copy()
# or
new_list = old_list[:]
Example 2: Python Copy Lists
thislist = ["apple", "banana", "cherry"]
mylist = thislist.copy()
print(mylist)
new_list = old_list.copy()
# or
new_list = old_list[:]
thislist = ["apple", "banana", "cherry"]
mylist = thislist.copy()
print(mylist)