Automatic commit performed through alias...

This commit is contained in:
Shaun Setlock
2020-06-24 20:50:14 -04:00
parent e424734ee1
commit bd59f0c09b

View File

@@ -42,8 +42,8 @@
"import time # Typically imported for sleep function, to slow down execution in terminal.\n", "import time # Typically imported for sleep function, to slow down execution in terminal.\n",
"import typing\n", "import typing\n",
"import decorators # Typically imported to compute execution duration of functions.\n", "import decorators # Typically imported to compute execution duration of functions.\n",
"import numpy\n", "import math\n",
"import pandas" "import numpy"
] ]
}, },
{ {
@@ -56,86 +56,59 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [ "source": [
"## Can we describe a few approaches to solving this problem?\n", "def get_c(a,b):\n",
"---" " c = math.sqrt(a*a+b*b)\n",
" return c"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def check_constraint(a,b,c,limit):\n",
" return (a+b+c)==limit"
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"*Let's discuss a few ways to work through this, then select one to implement.*\n", "# Brute Force!"
"\n",
" 1. Create \n",
"<br/>\n",
"<br/>\n",
" "
] ]
}, },
{ {
"cell_type": "markdown", "cell_type": "code",
"execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"200 375 425.0 1000.0 31875000.0\n"
]
}
],
"source": [ "source": [
"### Let's try the first approach!" "exit=False\n",
"for a in range(1,1000):\n",
" for b in range(a,1000):\n",
" c = get_c(a,b)\n",
" if check_constraint(a,b,c,1000):\n",
" #print(a,b,c)\n",
" #print(not_done)\n",
" exit=True\n",
" break\n",
" if exit:\n",
" break\n",
"print(a,b,c,a+b+c,a*b*c)\n"
] ]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### 1. a) Take in problem statement information."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
} }
], ],
"metadata": { "metadata": {