Files
learn-python3/notebooks/beginner/exercises/lists_exercise.ipynb
Jerry Pussinen 46450175dc Initial commit
2018-05-01 13:59:37 +02:00

109 lines
2.0 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1. Create a new list without modifiying the original one\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": false
},
"outputs": [],
"source": [
"original = ['I', 'am', 'learning', 'hacking', 'in']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Your implementation here\n",
"modified = 'TODO'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": false
},
"outputs": [],
"source": [
"assert original == ['I', 'am', 'learning', 'hacking', 'in']\n",
"assert modified == ['I', 'am', 'learning', 'lists', 'in', 'Python']"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 2. Create a merged sorted list"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": false
},
"outputs": [],
"source": [
"list1 = [6, 12, 5]\n",
"list2 = [6.2, 0, 14, 1]\n",
"list3 = [0.9]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Your implementation here\n",
"my_list = 'TODO'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": false,
"scrolled": true
},
"outputs": [],
"source": [
"print(my_list)\n",
"assert my_list == [14, 12, 6.2, 6, 5, 1, 0.9, 0]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}