Remove the IPYNB Checkpoints, Did Week 5 HW
-- IPYNB Checkpoints ++ Git Ignore File for IPYNB Checkpoints +- Week 5 Homework Files
This commit is contained in:
parent
4fc499169b
commit
140ffc6523
7 changed files with 219 additions and 60 deletions
|
|
@ -24,7 +24,8 @@
|
|||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"a + b + c - max(a, b, c) + min(a, b, c)"
|
||||
"a + b + c - (max(a, b, c) + min(a, b, c))\n",
|
||||
"# Originally: a + b + c - max(a, b, c) + min(a, b, c)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -38,15 +39,47 @@
|
|||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"888"
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Testing the interesting function: a + b + c - max(a, b, c) + min(a, b, c)\n",
|
||||
"\n",
|
||||
"# Using the test input vals a = 4, b = 2, c = 7\n",
|
||||
"\n",
|
||||
"##a = 4\n",
|
||||
"##b = 2\n",
|
||||
"##c = 7\n",
|
||||
"\n",
|
||||
"a = 999\n",
|
||||
"b = 345\n",
|
||||
"c = 888\n",
|
||||
"\n",
|
||||
"a + b + c - (max(a, b, c) + min(a, b, c))"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Code was not correct, would return a value that is not the middle one. By adding parentheses before the call of max and after the call of min, you can return a middle value of three variables every single time."
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
|
|
@ -60,7 +93,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.3"
|
||||
"version": "3.9.12"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue