diff --git a/problems/009_problem_jnotebook.ipynb b/problems/009_problem_jnotebook.ipynb
index 62d3c58..afa8064 100644
--- a/problems/009_problem_jnotebook.ipynb
+++ b/problems/009_problem_jnotebook.ipynb
@@ -42,8 +42,8 @@
"import time # Typically imported for sleep function, to slow down execution in terminal.\n",
"import typing\n",
"import decorators # Typically imported to compute execution duration of functions.\n",
- "import numpy\n",
- "import pandas"
+ "import math\n",
+ "import numpy"
]
},
{
@@ -56,86 +56,59 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 2,
"metadata": {},
"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": [
- "## 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",
"metadata": {},
"source": [
- "*Let's discuss a few ways to work through this, then select one to implement.*\n",
- "\n",
- " 1. Create \n",
- "
\n",
- "
\n",
- " "
+ "# Brute Force!"
]
},
{
- "cell_type": "markdown",
+ "cell_type": "code",
+ "execution_count": 4,
"metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "200 375 425.0 1000.0 31875000.0\n"
+ ]
+ }
+ ],
"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": {