what is .copy in python code example
Example 1: .copy python
new_list = list.copy()
# returns a new list without modifying the orginal list.
Example 2: python copy list
a=[1,2,3,4]
b=a[:]
''' now b has all elements of a'''
new_list = list.copy()
# returns a new list without modifying the orginal list.
a=[1,2,3,4]
b=a[:]
''' now b has all elements of a'''