Skip to content

Commit

Permalink
better trees, fixed lists
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLeoni committed Dec 8, 2019
1 parent 5893f6c commit 87db68d
Show file tree
Hide file tree
Showing 16 changed files with 837 additions and 334 deletions.
48 changes: 25 additions & 23 deletions exercises/lists/lists-solution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"A's ID: 140023584607560\n"
"A's ID: 140011862210440\n"
]
}
],
Expand Down Expand Up @@ -409,7 +409,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"A's ID: 140023584607560\n"
"A's ID: 140011862210440\n"
]
}
],
Expand Down Expand Up @@ -638,7 +638,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"A has id: 140023585018824\n"
"A has id: 140011862212360\n"
]
}
],
Expand Down Expand Up @@ -682,7 +682,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"A has id: 140023585018824\n"
"A has id: 140011862212360\n"
]
}
],
Expand Down Expand Up @@ -726,7 +726,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"A has id: 140023585018824\n"
"A has id: 140011862212360\n"
]
}
],
Expand Down Expand Up @@ -763,7 +763,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"A has now id: 140023357072648\n"
"A has now id: 140011852552776\n"
]
}
],
Expand Down Expand Up @@ -1864,9 +1864,9 @@
"output_type": "stream",
"text": [
"\n",
"A's id: 140023366009672\n",
"B's id: 140023366009672\n",
"C's id: 140023357471112\n"
"A's id: 140011852475016\n",
"B's id: 140011852475016\n",
"C's id: 140011852532744\n"
]
}
],
Expand Down Expand Up @@ -2436,7 +2436,13 @@
"metadata": {},
"source": [
"**Example:**\n",
"Given the list: [\"Hotel\", \"Icon\",\" Bus\",\"Train\", \"Hotel\", \"Eye\", \"Rain\", \"Elephant\"] create a list with all the first letters."
"Given the list: \n",
"\n",
"```python\n",
"[\"Hotel\", \"Icon\",\" Bus\",\"Train\", \"Hotel\", \"Eye\", \"Rain\", \"Elephant\"]\n",
"```\n",
"\n",
"create a list with all the first letters."
]
},
{
Expand All @@ -2463,13 +2469,6 @@
"print(\"\".join(initials))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -2677,9 +2676,9 @@
"\n",
"```python\n",
">>> threeven([6,4,8,4,5])\n",
"True\n",
"yes\n",
">>> threeven([2,5,6,3,4,5])\n",
"False\n",
"no\n",
">>> threeven([4])\n",
"not good\n",
"```"
Expand All @@ -2694,8 +2693,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"True\n",
"False\n",
"yes\n",
"no\n",
"not good\n"
]
}
Expand All @@ -2705,7 +2704,10 @@
"\n",
"def threeven(xs):\n",
" if len(xs) >= 3:\n",
" print(xs[0] % 2 == 0 and xs[1] % 2 == 0 and xs[2] % 2 == 0)\n",
" if xs[0] % 2 == 0 and xs[1] % 2 == 0 and xs[2] % 2 == 0:\n",
" print(\"yes\")\n",
" else:\n",
" print(\"no\")\n",
" else:\n",
" print(\"not good\")\n",
"\n",
Expand Down Expand Up @@ -4854,7 +4856,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Further resources\n",
"## Further exercises\n",
"\n",
"Have a look at [leetcode array problems](https://leetcode.com/tag/array/) sorting by _Acceptance_ and _Easy_.\n",
"\n",
Expand Down

0 comments on commit 87db68d

Please sign in to comment.