Updated publish to give more information about failure and created html for 28 to 31 in ipython.

This commit is contained in:
2018-02-10 10:50:52 +01:00
parent 60d4969eff
commit 2ef2c3e991
10 changed files with 1021 additions and 12 deletions

File diff suppressed because one or more lines are too long

0
ipython/EulerProblem028.ipynb Executable file → Normal file
View File

File diff suppressed because one or more lines are too long

8
ipython/EulerProblem029.ipynb Executable file → Normal file
View File

@@ -26,7 +26,9 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 1,
"metadata": {}, "metadata": {
"collapsed": false
},
"outputs": [ "outputs": [
{ {
"name": "stdout", "name": "stdout",
@@ -44,7 +46,7 @@
} }
], ],
"metadata": { "metadata": {
"comopletion_date": "Fri, 25 Aug 2017, 10:03", "completion_date": "Fri, 25 Aug 2017, 10:03",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3",
"language": "python", "language": "python",
@@ -60,7 +62,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.3" "version": "3.5.4"
}, },
"tags": [ "tags": [
"distinct", "distinct",

File diff suppressed because one or more lines are too long

0
ipython/EulerProblem030.ipynb Executable file → Normal file
View File

File diff suppressed because one or more lines are too long

22
ipython/EulerProblem031.ipynb Executable file → Normal file
View File

@@ -18,14 +18,12 @@
] ]
}, },
{ {
"cell_type": "code", "cell_type": "markdown",
"execution_count": null,
"metadata": { "metadata": {
"collapsed": true "collapsed": true
}, },
"outputs": [],
"source": [ "source": [
"I really have mental issues to this in a non recursive way." "I really have mental issues to this in a non recursive way. So here we go with recursion."
] ]
}, },
{ {
@@ -36,12 +34,18 @@
}, },
"outputs": [], "outputs": [],
"source": [ "source": [
"\n", "def get_different_ways(remainder, coins):\n",
" if not coins:\n",
" return 1\n",
" coin = coins[0]\n",
" combinations = 1\n",
" while remainder > 0:\n",
" " " "
] ]
} }
], ],
"metadata": { "metadata": {
"completion_date": "Fri, 25 Aug 2017, 13:02",
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3",
"language": "python", "language": "python",
@@ -57,8 +61,12 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.3" "version": "3.5.4"
} },
"tags": [
"recursion",
"coins"
]
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 2

View File

@@ -425,6 +425,60 @@
</td> </td>
</tr> </tr>
<tr>
<td>Problem 028</td>
<td>Wed, 23 Aug 2017, 15:54</td>
<td><a href="EulerProblem028.html">Problem 028</a></td>
<td>
<kbd>spiral</kbd>
<kbd>diagonals</kbd>
</td>
</tr>
<tr>
<td>Problem 029</td>
<td>Fri, 25 Aug 2017, 10:03</td>
<td><a href="EulerProblem029.html">Problem 029</a></td>
<td>
<kbd>distinct</kbd>
<kbd>powers</kbd>
</td>
</tr>
<tr>
<td>Problem 030</td>
<td>Fri, 25 Aug 2017, 12:13</td>
<td><a href="EulerProblem030.html">Problem 030</a></td>
<td>
<kbd>digit</kbd>
<kbd>powers</kbd>
<kbd>brute force</kbd>
</td>
</tr>
<tr>
<td>Problem 031</td>
<td>Fri, 25 Aug 2017, 13:02</td>
<td><a href="EulerProblem031.html">Problem 031</a></td>
<td>
<kbd>recursion</kbd>
<kbd>coins</kbd>
</td>
</tr>
<tr> <tr>
<td>Problem 067</td> <td>Problem 067</td>
<td>Fri, 5 Sep 2014, 07:36</td> <td>Fri, 5 Sep 2014, 07:36</td>

View File

@@ -11,8 +11,11 @@ def extract_metadata(ipynb_file):
Metadata = namedtuple('Metadata', ['tags', 'completion_date']) Metadata = namedtuple('Metadata', ['tags', 'completion_date'])
with open(ipynb_file, 'r') as f: with open(ipynb_file, 'r') as f:
j = json.load(f) j = json.load(f)
try:
tags = j['metadata']['tags'] tags = j['metadata']['tags']
completion_date = j['metadata']['completion_date'] completion_date = j['metadata']['completion_date']
except KeyError:
raise Exception('Failed extracting meta from {}.'.format(ipynb_file))
return Metadata(tags, completion_date) return Metadata(tags, completion_date)