Skip to content
This repository was archived by the owner on Jun 25, 2018. It is now read-only.

Commit 09d47c1

Browse files
committed
Improve comparison of values and objects of list and copy of list
1 parent 183b742 commit 09d47c1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: Introduction_to_python_day_1_session_3.ipynb

+9-1
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,17 @@
270270
"x = [123, 54, 92, 87, 33]\n",
271271
"y = x[:] # y is a copy of x\n",
272272
"z = x\n",
273+
"print(x)\n",
273274
"print(\"Are values of y and x the same?\", y == x)\n",
274275
"print(\"Are objects y and x the same?\", y is x)\n",
275-
"print(\"Are objects y and x not the same?\", y is not x)\n",
276+
"print(\"Are values of z and x the same?\", z == x)\n",
277+
"print(\"Are objects z and x the same?\", z is x)\n",
278+
"# Let's change x\n",
279+
"x[1] = 23\n",
280+
"print(x)\n",
281+
"print(\"Are values of y and x the same?\", y == x)\n",
282+
"print(\"Are objects y and x the same?\", y is x)\n",
283+
"print(\"Are values of z and x the same?\", z == x)\n",
276284
"print(\"Are objects z and x the same?\", z is x)"
277285
]
278286
},

0 commit comments

Comments
 (0)