From 8e4f9ec414f553746330423a974684bbac2163a8 Mon Sep 17 00:00:00 2001 From: kinitrupti Date: Thu, 15 Oct 2015 17:40:30 +0530 Subject: solved errors --- Practical_C_Programming/Chapter_15_1.ipynb | 72 ++++++++++-------------------- 1 file changed, 24 insertions(+), 48 deletions(-) (limited to 'Practical_C_Programming/Chapter_15_1.ipynb') 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\u001b[0m in \u001b[0;36m\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\u001b[0m in \u001b[0;36m\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", @@ -288,27 +266,19 @@ "language": "python", "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\u001b[0m in \u001b[0;36m\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\u001b[0m in \u001b[0;36m\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": {} -- cgit