FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add list by Vishesh-dd4723 · Pull Request #30 · jerry-git/learn-python3 · GitHub

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ipynb  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
27 changes: 26 additions & 1 deletion notebooks/beginner/notebooks/lists.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,31 @@
"print('original: {}, modified: {}'.format(original, modified))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Copying a list"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"list1 = [1,2,3]\n",
"#Don't\n",
"copy1 = list1 # It will simply point the pointer of copy1 to list1 i.e. changes in copy1 appears in list1 also\n",
"copy1[2] = 6\n",
"print(list1)\n",
"\n",
"#Do - Slicing\n",
"copy2 = list1[:] #It will copy every element of list1 to copy2\n",
"copy2[1] = 5\n",
"print(list1)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -310,7 +335,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down

Back | FazBrowse Home | New Git URL