diff --git a/toy-problems/toy-problem-003.ipynb b/toy-problems/toy-problem-003.ipynb index 49605cb2..74958280 100644 --- a/toy-problems/toy-problem-003.ipynb +++ b/toy-problems/toy-problem-003.ipynb @@ -278,7 +278,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -296,7 +296,7 @@ "\"i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url.\"" ] }, - "execution_count": 17, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" } @@ -369,6 +369,49 @@ "\n" ] }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "\"i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url.\"" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# solution with a built-in function str.maketrans()\n", + "\n", + "table = str.maketrans(\"abcdefghijklmnopqrstuvwxyz\", \"cdefghijklmnopqrstuvwxyzab\")\n", + "raw.translate(table)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + }, { "cell_type": "code", "execution_count": null,