diff options
author | kinitrupti | 2015-10-15 17:40:30 +0530 |
---|---|---|
committer | kinitrupti | 2015-10-15 17:40:30 +0530 |
commit | 8e4f9ec414f553746330423a974684bbac2163a8 (patch) | |
tree | 7d91d4997a3962c3ad62355ad369f7b6b7738ddb /Practical_C_Programming/Chapter_15_1.ipynb | |
parent | 79c8f29f70cc014d5fd8b9900d3c19309134bc1d (diff) | |
download | Python-Textbook-Companions-8e4f9ec414f553746330423a974684bbac2163a8.tar.gz Python-Textbook-Companions-8e4f9ec414f553746330423a974684bbac2163a8.tar.bz2 Python-Textbook-Companions-8e4f9ec414f553746330423a974684bbac2163a8.zip |
solved errors
Diffstat (limited to 'Practical_C_Programming/Chapter_15_1.ipynb')
-rwxr-xr-x | Practical_C_Programming/Chapter_15_1.ipynb | 72 |
1 files changed, 24 insertions, 48 deletions
diff --git a/Practical_C_Programming/Chapter_15_1.ipynb b/Practical_C_Programming/Chapter_15_1.ipynb index 34a86a67..05286d0f 100755 --- a/Practical_C_Programming/Chapter_15_1.ipynb +++ b/Practical_C_Programming/Chapter_15_1.ipynb @@ -173,19 +173,8 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "ename": "IOError", - "evalue": "[Errno 2] No such file or directory: 'numbers.dat'", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m<ipython-input-5-ce867c3a4ec5>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0min_file\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'numbers.dat'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[0mdata\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'numbers.dat'" - ] - } - ], - "prompt_number": 5 + "outputs": [], + "prompt_number": "*" }, { "cell_type": "heading", @@ -248,19 +237,8 @@ ], "language": "python", "metadata": {}, - "outputs": [ - { - "ename": "IOError", - "evalue": "[Errno 2] No such file or directory: 'numbers.dat'", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIOError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m<ipython-input-6-8cd3b79f72a3>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mimport\u001b[0m \u001b[0mos\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0min_file\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mopen\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'numbers.dat'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'r'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[0mdata\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mIOError\u001b[0m: [Errno 2] No such file or directory: 'numbers.dat'" - ] - } - ], - "prompt_number": 6 + "outputs": [], + "prompt_number": "*" }, { "cell_type": "heading", @@ -277,7 +255,7 @@ "\n", "# Variable declaration\n", "i = 1\n", - "j = 0\n", + "j = 1\n", "\n", "# Calculation and result\n", "print ('Starting\\n')\n", @@ -289,26 +267,18 @@ "metadata": {}, "outputs": [ { - "ename": "ZeroDivisionError", - "evalue": "integer division or modulo by zero", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m<ipython-input-7-289ff2a55d4d>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 10\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'Starting\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'Before divide...'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 12\u001b[1;33m \u001b[0mi\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mi\u001b[0m \u001b[1;33m/\u001b[0m \u001b[0mj\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 13\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'After\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mZeroDivisionError\u001b[0m: integer division or modulo by zero" - ] - }, - { "output_type": "stream", "stream": "stdout", "text": [ "Starting\n", "\n", - "Before divide...\n" + "Before divide...\n", + "After\n", + "\n" ] } ], - "prompt_number": 7 + "prompt_number": 9 }, { "cell_type": "heading", @@ -322,11 +292,11 @@ "cell_type": "code", "collapsed": false, "input": [ - "\n", + "from __future__ import division\n", "# Variable declaration\n", "import sys\n", "i = 1\n", - "j = 0\n", + "j = 1\n", "\n", "# Calculation and result\n", "print ('Starting\\n')\n", @@ -356,17 +326,23 @@ ] }, { - "ename": "ZeroDivisionError", - "evalue": "integer division or modulo by zero", - "output_type": "pyerr", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m<ipython-input-8-eedd2fda3e82>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 13\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'Before divide...'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mflush\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 15\u001b[1;33m \u001b[0mi\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mi\u001b[0m \u001b[1;33m/\u001b[0m \u001b[0mj\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 16\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'After\\n'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 17\u001b[0m \u001b[0msys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mstdout\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mflush\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mZeroDivisionError\u001b[0m: integer division or modulo by zero" + "output_type": "stream", + "stream": "stdout", + "text": [ + "After\n", + "\n" ] } ], "prompt_number": 8 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [], + "language": "python", + "metadata": {}, + "outputs": [] } ], "metadata": {} |