From 8bb2aa296bb44debdf52bf750a5a994fafc1572a Mon Sep 17 00:00:00 2001 From: Yukti-09 <44090430+Yukti-09@users.noreply.github.com> Date: Sun, 20 Oct 2019 17:00:40 +0530 Subject: [PATCH] example1.py --- example1.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 example1.py diff --git a/example1.py b/example1.py new file mode 100644 index 0000000..66a5a48 --- /dev/null +++ b/example1.py @@ -0,0 +1,14 @@ +a=[11,22] +b=a +The ids of the two will be the same. +Now, +a[0]=1 +The ids of the two will still be the same as both a and b are referring to the same location, changes made to a are made to b as well. +Hence, +a=[1,22] +b=[1,22] + +Now if we do +import copy +c=copy.deepcopy(a) +id(a) will not be equal to id(c)