<filename>assignment_day_26.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Assignment Day : 26

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/10K3GWzm5V8RH15Vrzw8ms7aOiRjSBa7b
"""

#Shallow copy
list1=['a',7,'er',21]
list2=['ytr',857,3,'y']
list3=list1[:]
print(list1,'#This is list1')
print(list3,'#This is list3')
print(id(list1))
print(id(list3))
list3 is list1

list1.append('nvidia')
list4=list(list1)
print(list1,'#This is appended list1')
print(list4,'#This is list4')
print(id(list1))
print(id(list4))
list4 is list1

#Deepcopy
from copy import deepcopy
list5=[5,43,['hi']]
list6=deepcopy(list5)
print(list6)

list5.append(8)
print(list5,'#This is appended list5')
print(list6,'#This is list6')

list5[2].append('inspiron')
print(list5,'#This is list5')
print(list6,'#This is list6')
<filename>assignment_day_26.py<gh_stars>0
# -*- coding: utf-8 -*-
"""Assignment Day : 26

Automatically generated by Colaboratory.

Original file is located at
    https://colab.research.google.com/drive/10K3GWzm5V8RH15Vrzw8ms7aOiRjSBa7b
"""

#Shallow copy
list1=['a',7,'er',21]
list2=['ytr',857,3,'y']
list3=list1[:]
print(list1,'#This is list1')
print(list3,'#This is list3')
print(id(list1))
print(id(list3))
list3 is list1

list1.append('nvidia')
list4=list(list1)
print(list1,'#This is appended list1')
print(list4,'#This is list4')
print(id(list1))
print(id(list4))
list4 is list1

#Deepcopy
from copy import deepcopy
list5=[5,43,['hi']]
list6=deepcopy(list5)
print(list6)

list5.append(8)
print(list5,'#This is appended list5')
print(list6,'#This is list6')

list5[2].append('inspiron')
print(list5,'#This is list5')
print(list6,'#This is list6')
# -*- coding: utf-8 -*- Assignment Day : 26  Automatically generated by Colaboratory.  Original file is located at     https://colab.research.google.com/drive/10K3GWzm5V8RH15Vrzw8ms7aOiRjSBa7b #Shallow copy #Deepcopy