Added Files, Changed Folder Names, AND MUCH MORE!
++ Week 5 Folder ++ Week 5 Homework +- Week 2 Folder Name
This commit is contained in:
parent
ee3222c4ab
commit
4fc499169b
13 changed files with 538 additions and 0 deletions
68
Week-5/05_maxmin.ipynb
Normal file
68
Week-5/05_maxmin.ipynb
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## The Middle"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Suppose that Yulin, another INF110 student, is tasked with writing code to find the middle of three distinct numbers named `a`, `b`, and `c`. (By “middle” we mean the value that is neither the maximum nor the minimum.) For example, given the values 4, 2, and 7, the code should give back 4.\n",
|
||||
"\n",
|
||||
"Yulin has a moment of inspired thought and rapidly types the following into her Jupyter notebook:"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": true
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"a + b + c - max(a, b, c) + min(a, b, c)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Is her code correct? Why or why not? If not, make a *simple* change to the cell above to fix it.\n",
|
||||
"\n",
|
||||
"*Hint:* Running the cell will produce an error because we haven't defined `a`, `b`, and `c`, but you're free to make any changes you want to test your ideas. (When you submit, just indicate which cell is your final answer.)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"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.8.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue