Skip to content

Commit

Permalink
copy() under lists are mutable
Browse files Browse the repository at this point in the history
  • Loading branch information
manoharganta256 committed Oct 27, 2018
1 parent 4f4290b commit 0d199a8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion notebooks/beginner/notebooks/lists.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
"source": [
"original = [1, 2, 3]\n",
"modified = list(original) # Note list() \n",
"# Alternatively, you can use copy method\n",
"# modified = original.copy()\n",
"modified[0] = 99\n",
"print('original: {}, modified: {}'.format(original, modified))"
]
Expand Down Expand Up @@ -308,7 +310,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 0d199a8

Please sign in to comment.