Skip to content

Commit

Permalink
restore exercises
Browse files Browse the repository at this point in the history
  • Loading branch information
philtweir committed Jun 24, 2024
1 parent ec20d79 commit 7eaf344
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions 002-basic-control-structures/Basic control structures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1117,12 +1117,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "ZeroDivisionError",
"evalue": "division by zero",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[1], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m y \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m120\u001b[39m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m z \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mrange\u001b[39m(\u001b[38;5;241m5\u001b[39m):\n\u001b[0;32m----> 3\u001b[0m y \u001b[38;5;241m=\u001b[39m \u001b[43my\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m/\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mz\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mWhen z is\u001b[39m\u001b[38;5;124m\"\u001b[39m, z, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mthen y is\u001b[39m\u001b[38;5;124m\"\u001b[39m, y)\n",
"\u001b[0;31mZeroDivisionError\u001b[0m: division by zero"
]
}
],
"source": [
"y = 120\n",
"for z in range(1, 5, 2):\n",
"for z in range(5):\n",
" y = y / z\n",
" print(\"When z is\", z, \"then y is\", y)"
]
Expand Down Expand Up @@ -2546,7 +2558,7 @@
"metadata": {
"celltoolbar": "Slideshow",
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -2560,13 +2572,13 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.11"
"version": "3.11.6"
},
"livereveal": {
"theme": "beige",
"transition": "cascade"
}
},
"nbformat": 4,
"nbformat_minor": 1
"nbformat_minor": 4
}

0 comments on commit 7eaf344

Please sign in to comment.