One of the ways to copy the list without using any module is n = l[:]
:
l = list(range(0,101,2)) # get list of even values from 0 to 100
n = l[:] # copy data from l to n
print (l) # check data of l
print(n) # check data of n
l.pop() # remove last element from l
print(l) # It prints only 0 to 98
print(n) # It prints from 0 to 100 (can you see here, changing l doesnot impact n)
Now if you use n = l
directly then any change in l
will change the value in n
, check below code:
l = list(range(0,101,2))
n=l
print (l) # check data of l
print(n) # check data of n
l.pop() # remove last element from l
print(l) # It prints from 0 to 98
print(n) # It prints from 0 to 98