Files
learn-python3/notebooks/beginner/exercises/02_numbers_exercise.ipynb
Jerry Pussinen fb4b0e6be9 Add numbering and regenerate html
Also fixed some ipytest things
2023-04-19 10:22:59 +03:00

92 lines
1.6 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 1. Creating formulas\n",
"Write the following mathematical formula in Python:\n",
"\n",
"\\begin{align}\n",
" result = 6a^3 - \\frac{8b^2 }{4c} + 11\n",
"\\end{align}\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": false
},
"outputs": [],
"source": [
"a = 2\n",
"b = 3\n",
"c = 2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Your formula here:\n",
"result = "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"editable": false
},
"outputs": [],
"source": [
"assert result == 50"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 2. Floating point pitfalls\n",
"Show that `0.1 + 0.2 == 0.3`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Your solution here\n",
"\n",
"# This won't work:\n",
"# assert 0.1 + 0.2 == 0.3"
]
}
],
"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
}