Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add additional items to lists exercise
  • Loading branch information
shivapbhusal committed Sep 6, 2020
commit d2948245d5970094de7a0f322c09eb2e20d16a95
82 changes: 81 additions & 1 deletion notebooks/beginner/exercises/lists_exercise.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,86 @@
"print(my_list)\n",
"assert my_list == [14, 12, 6.2, 6, 5, 1, 0.9, 0]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 4. Remove items from right "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_list = [1, 2, 3]\n",
"my_list.____\n",
"my_list.____"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"assert my_list == [1]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 5. Insert an item at a given position"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_list = ['I', 'am', 'Python']\n",
"#Let's insert an item after 'am'\n",
"my_list.____(____, ____)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"assert my_list = ['I', 'am', 'learning', 'Python']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 6. Remove all items from a list"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"my_list = [1, 2, 3]\n",
"my_list.____"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"assert my_list == []"
]
}
],
"metadata": {
Expand All @@ -141,7 +221,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
"version": "3.7.3"
}
},
"nbformat": 4,
Expand Down