summaryrefslogtreecommitdiff
path: root/Practical_C_Programming_by_Steve_Oualline
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:53:46 +0530
committerkinitrupti2017-05-12 18:53:46 +0530
commitf270f72badd9c61d48f290c3396004802841b9df (patch)
treebc8ba99d85644c62716ce397fe60177095b303db /Practical_C_Programming_by_Steve_Oualline
parent64d949698432e05f2a372d9edc859c5b9df1f438 (diff)
downloadPython-Textbook-Companions-f270f72badd9c61d48f290c3396004802841b9df.tar.gz
Python-Textbook-Companions-f270f72badd9c61d48f290c3396004802841b9df.tar.bz2
Python-Textbook-Companions-f270f72badd9c61d48f290c3396004802841b9df.zip
Removed duplicates
Diffstat (limited to 'Practical_C_Programming_by_Steve_Oualline')
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_10_1.ipynb414
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_11_1.ipynb134
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb60
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_13_1.ipynb526
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_14_1.ipynb175
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_15_1.ipynb351
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_16_1.ipynb74
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_17_1.ipynb199
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_18_1.ipynb109
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_19_1.ipynb197
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_21_1.ipynb65
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_23_1.ipynb59
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_2_3.ipynb1112
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_3_4.ipynb53
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_4_4.ipynb258
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_5_4.ipynb404
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_6_4.ipynb224
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_7_4.ipynb184
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_8_4.ipynb349
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/Chapter_9_4.ipynb166
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/README.txt10
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/numbers.dat1
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/numbers.dat~0
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/screenshots/ancientcompilers.pngbin0 -> 38427 bytes
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/screenshots/bitoperations.pngbin0 -> 44165 bytes
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/screenshots/mahesh-1.pngbin0 -> 30367 bytes
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/screenshots/mahesh-2.pngbin0 -> 20249 bytes
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/screenshots/mahesh-3.pngbin0 -> 33358 bytes
-rwxr-xr-xPractical_C_Programming_by_Steve_Oualline/screenshots/programmingprocess.pngbin0 -> 41674 bytes
29 files changed, 5124 insertions, 0 deletions
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_10_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_10_1.ipynb
new file mode 100755
index 00000000..616dbfad
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_10_1.ipynb
@@ -0,0 +1,414 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e0192e34ad6ee5352df14e6445eee01302e3e7af1b8414d8a9190c3936e04b7a"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10: C Preprocessor"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.1, Page number: 172"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "data = []\n",
+ "twice = []\n",
+ "\n",
+ "# Calculation and result\n",
+ "for index in range (0, 10) :\n",
+ " data.append(index)\n",
+ " twice.append(2 * index)\n",
+ "\n",
+ "print (data)\n",
+ "print (twice)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n",
+ "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.2, Page number: 173"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "data = []\n",
+ "twice = []\n",
+ "\n",
+ "# Calculation and result\n",
+ "for index in range (0, 20) :\n",
+ " data.append(index)\n",
+ " twice.append(2 * index)\n",
+ "\n",
+ "print (data)\n",
+ "print (twice)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n",
+ "[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38]\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.3, Page number: 175"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "BIG_NUMBER = 10 * 10\n",
+ "index = 1\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (index < BIG_NUMBER) :\n",
+ " index = index * 8\n",
+ " print ('%d' % index)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "8\n",
+ "64\n",
+ "512\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.4, Page number: 176"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "FIRST_PART = 7\n",
+ "LAST_PART = 5\n",
+ "ALL_PARTS = FIRST_PART + LAST_PART\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('The square of all the parts is %d' % (ALL_PARTS * ALL_PARTS))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The square of all the parts is 144\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.5, Page number: 177"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "for i in reversed (range(10)) :\n",
+ " print ('Hi there')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n",
+ "Hi there\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.6, Page number: 177"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "size = 10\n",
+ "fudge = size - 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "size = fudge\n",
+ "print ('Size is %d' % size)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Size is 8\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.7, Page number: 178"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import sys\n",
+ "value = 1\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (value < 0) :\n",
+ " sys.exit()\n",
+ "\n",
+ "print ('We did not die')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "We did not die\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.8, Page number: 184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def SQR (x) :\n",
+ " return x * x\n",
+ " \n",
+ "for counter in range (0, 5) :\n",
+ " print ('x %d, x squared %d\\n' % (counter + 1, SQR (counter + 1)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x 1, x squared 1\n",
+ "\n",
+ "x 2, x squared 4\n",
+ "\n",
+ "x 3, x squared 9\n",
+ "\n",
+ "x 4, x squared 16\n",
+ "\n",
+ "x 5, x squared 25\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.9, Page number: 184"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "counter = 0\n",
+ "\n",
+ "# Function declaration, calculation and result\n",
+ "def SQR (x) :\n",
+ " return x * x\n",
+ " \n",
+ "while (counter < 5) :\n",
+ " print ('x %d square %d\\n' % (counter + 1, SQR (counter + 1)))\n",
+ " counter += 1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "x 1 square 1\n",
+ "\n",
+ "x 2 square 4\n",
+ "\n",
+ "x 3 square 9\n",
+ "\n",
+ "x 4 square 16\n",
+ "\n",
+ "x 5 square 25\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 10.10, Page number: 185"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def reciprocal (number) :\n",
+ " return 1 / number\n",
+ " \n",
+ "for counter in range (1, 10) :\n",
+ " print ('1/%f = %f\\n' % (counter, reciprocal (counter)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1/1.000000 = 1.000000\n",
+ "\n",
+ "1/2.000000 = 0.000000\n",
+ "\n",
+ "1/3.000000 = 0.000000\n",
+ "\n",
+ "1/4.000000 = 0.000000\n",
+ "\n",
+ "1/5.000000 = 0.000000\n",
+ "\n",
+ "1/6.000000 = 0.000000\n",
+ "\n",
+ "1/7.000000 = 0.000000\n",
+ "\n",
+ "1/8.000000 = 0.000000\n",
+ "\n",
+ "1/9.000000 = 0.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_11_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_11_1.ipynb
new file mode 100755
index 00000000..348ea0f2
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_11_1.ipynb
@@ -0,0 +1,134 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:189fb021544012d2bd6866a28aeac9bea1998c8f59c87bf7f6fbc3d56515bb70"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11: Bit operations"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.1, Page number: 193"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "i1 = 4\n",
+ "i2 = 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "if ((i1 != 0) and (i2 != 0)) :\n",
+ " print ('Both are not zero\\n')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Both are not zero\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.2, Page number: 201"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "HIGH_SPEED = 1 << 7\n",
+ "DIRECT_CONNECT = 1 << 8\n",
+ "\n",
+ "flags = 0\n",
+ "flags |= HIGH_SPEED\n",
+ "flags |= DIRECT_CONNECT\n",
+ "\n",
+ "# Calculation and result\n",
+ "if ((flags & HIGH_SPEED) != 0) :\n",
+ " print ('High speed set\\n')\n",
+ "\n",
+ "if ((flags & DIRECT_CONNECT) != 0) :\n",
+ " print ('Direct connect set\\n')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "High speed set\n",
+ "\n",
+ "Direct connect set\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 11.4, Page number: 207"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "i = 0x80\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (i != 0) :\n",
+ " print ('i is %x (%d) \\n' % (i, i))\n",
+ " i = i >> 1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i is 80 (128) \n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb
new file mode 100755
index 00000000..090a4ee1
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_12_1.ipynb
@@ -0,0 +1,60 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:184261c50791da479b656a01719125426370a323ab51da034b4dc57d574572c3"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 12: Advanced types"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 12.1, Page number: 212"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Union declaration\n",
+ "from ctypes import *\n",
+ "class value (Union) :\n",
+ " _fields_ = [(\"i_value\", c_int),\n",
+ " (\"f_value\", c_float)]\n",
+ "\n",
+ "# Calculation and result\n",
+ "data = value (3, 5.0)\n",
+ "print (data.i_value, data.f_value)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(1084227584, 5.0)\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_13_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_13_1.ipynb
new file mode 100755
index 00000000..e3f18fc3
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_13_1.ipynb
@@ -0,0 +1,526 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e550d25cd0a5a3cbfd731b0cd1d4a1ad11e5182b8955b4cee863068b4cfdaf40"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 13: Simple pointers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.1, Page number: 225"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "thing_var = 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Thing %d' % thing_var)\n",
+ "\n",
+ "thing_ptr = thing_var\n",
+ "thing_ptr = 3\n",
+ "print ('Thing %d' % thing_ptr)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Thing 2\n",
+ "Thing 3\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.2, Page number: 227"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration\n",
+ "def inc_count (count_ptr) :\n",
+ " count_ptr += 1\n",
+ " return count_ptr\n",
+ "\n",
+ "# Calculation and result\n",
+ "count = 0\n",
+ "\n",
+ "while (count < 10) :\n",
+ " print ('Count %d\\n' % inc_count (count))\n",
+ " count += 1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Count 1\n",
+ "\n",
+ "Count 2\n",
+ "\n",
+ "Count 3\n",
+ "\n",
+ "Count 4\n",
+ "\n",
+ "Count 5\n",
+ "\n",
+ "Count 6\n",
+ "\n",
+ "Count 7\n",
+ "\n",
+ "Count 8\n",
+ "\n",
+ "Count 9\n",
+ "\n",
+ "Count 10\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.3, Page number: 230"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "array = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('&array[index] (array+index) array[index]\\n')\n",
+ "\n",
+ "for index in range (0, 10) :\n",
+ " print ('0x%s 0x%s 0x%s\\n' % (id (array[index]), id (array[index]), array[index]))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "&array[index] (array+index) array[index]\n",
+ "\n",
+ "0x20916008 0x20916008 0x0\n",
+ "\n",
+ "0x20270280 0x20270280 0x1\n",
+ "\n",
+ "0x20733728 0x20733728 0x2\n",
+ "\n",
+ "0x20916464 0x20916464 0x3\n",
+ "\n",
+ "0x20270232 0x20270232 0x4\n",
+ "\n",
+ "0x20733560 0x20733560 0x5\n",
+ "\n",
+ "0x20270256 0x20270256 0x6\n",
+ "\n",
+ "0x20733752 0x20733752 0x7\n",
+ "\n",
+ "0x20916512 0x20916512 0x8\n",
+ "\n",
+ "0x20916032 0x20916032 0x9\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.4, Page number: 232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "array = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\n",
+ "index = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (array[index] != 0) :\n",
+ " index += 1\n",
+ "\n",
+ "print ('Number of elements before zero %d\\n' % index)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Number of elements before zero 6\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.5, Page number: 232"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "array = [4, 5, 8, 9, 8, 1, 0, 1, 9, 3]\n",
+ "index = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (array[index] != 0) :\n",
+ " index += 1\n",
+ "\n",
+ "print ('Number of elements before zero %d\\n' % index)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Number of elements before zero 6\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.6, Page number: 233"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "data = []\n",
+ "\n",
+ "# Calculation and result\n",
+ "for index in range (0, 10) :\n",
+ " data.append(0)\n",
+ "print (data)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.10, Page number: 238"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "line = 'Steve/Oualline'\n",
+ "\n",
+ "# Calculation and result\n",
+ "first_ptr, last_ptr = line.split('/')\n",
+ "print ('First: %s Last: %s\\n' % (first_ptr, last_ptr))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "First: Steve Last: Oualline\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.11, Page number: 240"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def tmp_name() :\n",
+ " if not hasattr (tmp_name, 'sequence') :\n",
+ " tmp_name.sequence = 0\n",
+ " tmp_name.sequence += 1\n",
+ " name = 'tmp'\n",
+ " name += str (tmp_name.sequence)\n",
+ " return name\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Name: %s\\n' % tmp_name())"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Name: tmp1\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.12, Page number: 245"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable and function declaration\n",
+ "import sys\n",
+ "v_count = sys.argv\n",
+ "counter = len(sys.argv)\n",
+ "\n",
+ "# Produces verbose messages\n",
+ "verbose = 0\n",
+ "\n",
+ "# Sends output to a file\n",
+ "out_file = open ('print.out', 'w')\n",
+ "\n",
+ "# Sets the number of lines per page\n",
+ "line_max = 66\n",
+ "\n",
+ "def do_file (name) :\n",
+ " print ('Verbose %d Lines %d Input %s Output %s\\n' % (verbose, line_max, name, out_file.name))\n",
+ "\n",
+ "def usage() :\n",
+ " print ('Usage is %s [options] [file-list]\\n' % program_name)\n",
+ " print ('Options\\n')\n",
+ " print (' -v verbose\\n')\n",
+ " print (' -l<number> Number of lines\\n')\n",
+ " print (' -o<name> Set output filename\\n')\n",
+ " sys.exit(1)\n",
+ " \n",
+ "# Calculation and result\n",
+ "program_name = str (sys.argv[0])\n",
+ "\n",
+ "while ((counter > 1) and (sys.argv[1][0] == '-')) :\n",
+ " if (sys.argv[1][1] == 'v') :\n",
+ " verbose = 1\n",
+ " break\n",
+ "\n",
+ " elif (sys.argv[1][1] == 'o') :\n",
+ " temp = str (sys.argv[1])\n",
+ " out_file.write (temp)\n",
+ " break\n",
+ "\n",
+ " elif (sys.argv[1][1] == 'l') :\n",
+ " line_max = int (sys.argv[1][2])\n",
+ " break\n",
+ "\n",
+ " else :\n",
+ " print ('Bad option %s\\n' % sys.argv[1])\n",
+ " usage()\n",
+ "\n",
+ " for index in range (0, counter) :\n",
+ " if (index == counter - 1) :\n",
+ " break\n",
+ " else :\n",
+ " v_count[index] = v_count[index + 1]\n",
+ "\n",
+ " counter -= 1\n",
+ "\n",
+ "if (counter == 1) :\n",
+ " do_file ('print.in')\n",
+ "\n",
+ "else :\n",
+ " while (counter > 1) :\n",
+ " do_file (sys.argv[1])\n",
+ "\n",
+ " for index in range (0, counter) :\n",
+ " if (index == counter - 1) :\n",
+ " break\n",
+ " else :\n",
+ " v_count[index] = v_count[index + 1]\n",
+ " \n",
+ " counter -= 1\n",
+ "\n",
+ "out_file.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "SystemExit",
+ "evalue": "1",
+ "output_type": "pyerr",
+ "traceback": [
+ "An exception has occurred, use %tb to see the full traceback.\n",
+ "\u001b[1;31mSystemExit\u001b[0m\u001b[1;31m:\u001b[0m 1\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Bad option -f\n",
+ "\n",
+ "Usage is -c [options] [file-list]\n",
+ "\n",
+ "Options\n",
+ "\n",
+ " -v verbose\n",
+ "\n",
+ " -l<number> Number of lines\n",
+ "\n",
+ " -o<name> Set output filename\n",
+ "\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stderr",
+ "text": [
+ "To exit: use 'exit', 'quit', or Ctrl-D."
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 13.13, Page number: 248"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Function declaration\n",
+ "def tmp_name() :\n",
+ " if not hasattr (tmp_name, 'sequence') :\n",
+ " tmp_name.sequence = 0\n",
+ " tmp_name.sequence += 1\n",
+ " name = 'tmp'\n",
+ " name += str (tmp_name.sequence)\n",
+ " return name\n",
+ "\n",
+ "# Calculation and result\n",
+ "name1 = tmp_name()\n",
+ "name2 = tmp_name()\n",
+ "print ('Name1: %s\\n' % name1)\n",
+ "print ('Name2: %s\\n' % name2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Name1: tmp1\n",
+ "\n",
+ "Name2: tmp2\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_14_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_14_1.ipynb
new file mode 100755
index 00000000..c25523b7
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_14_1.ipynb
@@ -0,0 +1,175 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:aaf3603d1f605477459dd54990dcc4c8c154c9c808805468e92c30fde9487343"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Chapter 14: File input/output"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 14.1, Page number: 253"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import os\n",
+ "count = 0\n",
+ "in_file = open ('input.txt', 'r')\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('input.txt') :\n",
+ " print ('Cannot open input.txt\\n')\n",
+ "\n",
+ "while (1) :\n",
+ " ch = in_file.read(1)\n",
+ " if not ch :\n",
+ " break\n",
+ " count += 1\n",
+ "\n",
+ "print ('Number of characters in input.txt is %d\\n' % count)\n",
+ "\n",
+ "in_file.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Number of characters in input.txt is 0\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 14.3, Page number: 257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "in_file = open ('input.txt', 'r')\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('input.txt') :\n",
+ " print ('Could not open file\\n')\n",
+ " sys.exit(1)\n",
+ "print ('File found\\n')\n",
+ "\n",
+ "in_file.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "File found\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 14.4, Page number: 260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "out_file = open ('test.out', 'w')\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('test.out') :\n",
+ " print ('Cannot open output file\\n')\n",
+ " sys.exit(1)\n",
+ "\n",
+ "for cur_char in range (0, 128) :\n",
+ " out_file.write(str (cur_char))\n",
+ " out_file.write('\\n')\n",
+ "\n",
+ "out_file.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 14.5, Page number: 267"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "txt_file = open ('input.txt')\n",
+ "\n",
+ "source_content = txt_file.read()\n",
+ "\n",
+ "target = open ('output.txt', 'w')\n",
+ "\n",
+ "# Calculation and result\n",
+ "target.write(source_content)\n",
+ "print ('Content copied')\n",
+ "\n",
+ "target.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_15_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_15_1.ipynb
new file mode 100755
index 00000000..05286d0f
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_15_1.ipynb
@@ -0,0 +1,351 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:23b3891085deb8af52412d44380b6187a4110d7e026531ec90b3b2ae79d61d0f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 15: Debugging and optimization"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 15.1, Page number: 275"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def lookup (name) :\n",
+ " lists = ['John', 'Jim', 'Jane', 'Clyde']\n",
+ " result = 0\n",
+ "\n",
+ " for index in range (0, 4) :\n",
+ " if (lists[index] == name) :\n",
+ " result = 1\n",
+ " break\n",
+ " \n",
+ " return result\n",
+ "\n",
+ "# Calculation and result\n",
+ "name = 'John'\n",
+ "\n",
+ "if (lookup (name)) :\n",
+ " print ('%s is in the list\\n' % name)\n",
+ "else :\n",
+ " print ('%s is not in the list\\n' % name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "John is in the list\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 15.6, Page number: 288"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable and function declaration\n",
+ "seven_count = 0\n",
+ "three_count = 0\n",
+ "data = []\n",
+ "\n",
+ "def get_data (data) :\n",
+ " for i in range (0, 5) :\n",
+ " x = 3\n",
+ " data.append(int(x))\n",
+ " print (data)\n",
+ "\n",
+ "# Calculation\n",
+ "get_data (data)\n",
+ "for index in range (0, 5) :\n",
+ " if data[index] == 3 :\n",
+ " three_count += 1\n",
+ "\n",
+ " if data[index] == 7 :\n",
+ " seven_count += 1\n",
+ "\n",
+ "# Result\n",
+ "print ('Threes %d Sevens %d' % (three_count, seven_count))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[3, 3, 3, 3, 3]\n",
+ "Threes 5 Sevens 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 15.7, Page number: 292"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "in_file = open ('numbers.dat', 'r')\n",
+ "\n",
+ "data = []\n",
+ "max_count = 0\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('numbers.dat') :\n",
+ " print ('Error:Unable to open numbers.dat\\n')\n",
+ " sys.exit(1)\n",
+ "\n",
+ "for line in in_file :\n",
+ " data.append(line)\n",
+ " max_count += 1\n",
+ "\n",
+ "while (1) :\n",
+ " search = 6\n",
+ " \n",
+ " if (search == -1) :\n",
+ " break\n",
+ "\n",
+ " low = 0\n",
+ " high = max_count\n",
+ "\n",
+ " while (1) :\n",
+ " mid = (low + high) / 2\n",
+ " middle = int (mid) \n",
+ "\n",
+ " if (int (data[middle]) == search) :\n",
+ " print ('Found at index %d\\n' % (middle + 1))\n",
+ " break\n",
+ "\n",
+ " if (low == high) :\n",
+ " print ('Not found\\n')\n",
+ " break\n",
+ "\n",
+ " if (int (data[middle]) < search) :\n",
+ " low = middle\n",
+ " else :\n",
+ " high = middle \n",
+ "\n",
+ "in_file.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": "*"
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 15.8, Page number: 300"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "import os\n",
+ "in_file = open ('numbers.dat', 'r')\n",
+ "\n",
+ "data = []\n",
+ "max_count = 0\n",
+ " \n",
+ "# Calculation and result\n",
+ "if not os.path.exists ('numbers.dat') :\n",
+ " print ('Error:Unable to open numbers.dat\\n')\n",
+ " sys.exit(1)\n",
+ "\n",
+ "for line in in_file :\n",
+ " data.append(line)\n",
+ " max_count += 1\n",
+ "\n",
+ "while (1) :\n",
+ " search = 14\n",
+ " \n",
+ " if (search == -1) :\n",
+ " break\n",
+ "\n",
+ " low = 0\n",
+ " high = max_count\n",
+ "\n",
+ " while (1) :\n",
+ " mid = (low + high) / 2\n",
+ " middle = int (mid) \n",
+ "\n",
+ " if (int (data[middle]) == search) :\n",
+ " print ('Found at index %d\\n' % (middle + 1))\n",
+ " break\n",
+ "\n",
+ " if (low == high) :\n",
+ " print ('Not found\\n')\n",
+ " break\n",
+ "\n",
+ " if (int (data[middle]) < search) :\n",
+ " low = middle\n",
+ " else :\n",
+ " high = middle \n",
+ "\n",
+ "in_file.close()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [],
+ "prompt_number": "*"
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 15.10, Page number: 304"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "i = 1\n",
+ "j = 1\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Starting\\n')\n",
+ "print ('Before divide...')\n",
+ "i = i / j\n",
+ "print ('After\\n')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Starting\n",
+ "\n",
+ "Before divide...\n",
+ "After\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 15.11, Page number: 304"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from __future__ import division\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "i = 1\n",
+ "j = 1\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Starting\\n')\n",
+ "sys.stdout.flush()\n",
+ "print ('Before divide...')\n",
+ "sys.stdout.flush()\n",
+ "i = i / j\n",
+ "print ('After\\n')\n",
+ "sys.stdout.flush()"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Starting\n",
+ "\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Before divide...\n"
+ ]
+ },
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "After\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_16_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_16_1.ipynb
new file mode 100755
index 00000000..505718fd
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_16_1.ipynb
@@ -0,0 +1,74 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:8846db95d13f18ddbaba03cb28aa141be8268e397ec14735e02a0f66209b0b25"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 16: Floating point"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 16.1, Page number: 322"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "number1 = 1.0\n",
+ "number2 = 1.0\n",
+ "counter = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (number1 + number2 != number1) :\n",
+ " counter += 1\n",
+ " number2 = number2 / 10.0\n",
+ "\n",
+ "print ('%2d digits accuracy in calculations\\n' % counter)\n",
+ "\n",
+ "\n",
+ "number2 = 1.0\n",
+ "counter = 0\n",
+ "\n",
+ "result = number1 + number2\n",
+ "counter += 1\n",
+ "number2 = number2 / 10.0\n",
+ "\n",
+ "print ('%2d digits accuracy in storage\\n' % counter)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "16 digits accuracy in calculations\n",
+ "\n",
+ " 1 digits accuracy in storage\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_17_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_17_1.ipynb
new file mode 100755
index 00000000..3d179b54
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_17_1.ipynb
@@ -0,0 +1,199 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:359ba0990b58235e80b2e0192de2b1c02844fb6d8275025bc2e3f3cf33cfcdf1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 17: Advanced Pointers "
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 17.1, Page number: 331"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Structure declaration\n",
+ "from ctypes import *\n",
+ "\n",
+ "class person (Structure) :\n",
+ "_fields_ = [(\"name\", c_wchar_p), (\"address\", c_wchar_p), (\"city_state_zip\", c_wchar_p), (\"age\", c_int), (\"height\", c_float)]"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 17.2, Page number: 336"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def lookup (name) :\n",
+ " lists = ['John', 'Jim', 'Jane', 'Clyde']\n",
+ " result = 0\n",
+ "\n",
+ " for index in range (0, 4) :\n",
+ " if (lists[index] == name) :\n",
+ " result = 1\n",
+ " break\n",
+ " \n",
+ " return result\n",
+ "\n",
+ "# Calculation and result\n",
+ "name = 'Jane'\n",
+ "\n",
+ "if (lookup (name)) :\n",
+ " print ('%s is in the list\\n' % name)\n",
+ "else :\n",
+ " print ('%s is not in the list\\n' % name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Jane is in the list\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 17.3, Page number: 338"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Declaration and result\n",
+ "aList = [45, 89, 123]\n",
+ "\n",
+ "aList.insert(1, 53)\n",
+ "\n",
+ "print 'Final List : ', aList"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Final List : [45, 53, 89, 123]\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 17.4, Page number: 348"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Class declaration\n",
+ "class Node:\n",
+ " def __init__(self, val):\n",
+ " self.l_child = None\n",
+ " self.r_child = None\n",
+ " self.data = val\n",
+ "\n",
+ "def binary_insert(root, node):\n",
+ " if root is None:\n",
+ " root = node\n",
+ " else:\n",
+ " if root.data > node.data:\n",
+ " if root.l_child == None:\n",
+ " root.l_child = node\n",
+ " else:\n",
+ " binary_insert(root.l_child, node)\n",
+ " else:\n",
+ " if root.r_child == None:\n",
+ " root.r_child = node\n",
+ " else:\n",
+ " binary_insert(root.r_child, node)\n",
+ "\n",
+ "def in_order_print(root):\n",
+ " if not root:\n",
+ " return\n",
+ " in_order_print(root.l_child)\n",
+ " print root.data\n",
+ " in_order_print(root.r_child)\n",
+ "\n",
+ "r = Node('Lemon')\n",
+ "binary_insert(r, Node('Plum'))\n",
+ "binary_insert(r, Node('Apple'))\n",
+ "binary_insert(r, Node('Orange'))\n",
+ "binary_insert(r, Node('Pear'))\n",
+ "binary_insert(r, Node('Grape'))\n",
+ "\n",
+ "\n",
+ "# Result\n",
+ "print \"List of words in ASCII order:\"\n",
+ "in_order_print(r)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "List of words in ASCII order:\n",
+ "Apple\n",
+ "Grape\n",
+ "Lemon\n",
+ "Orange\n",
+ "Pear\n",
+ "Plum\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_18_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_18_1.ipynb
new file mode 100755
index 00000000..0369d712
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_18_1.ipynb
@@ -0,0 +1,109 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2d44df2c3fb888f51302e9d5a213984c3dfb884f4d72dcb60cfc8091b69443e6"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 18: Modular Programming"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 18.2, Page number: 364"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "array = [1, 2, 3, 4, 5]\n",
+ "array_size = 10\n",
+ "num = 6\n",
+ "\n",
+ "# Calculation\n",
+ "for index in range (5, 10) :\n",
+ " array.insert(index, num)\n",
+ " num = num + 1\n",
+ "\n",
+ "# Result\n",
+ "print \"Contents of array of size 10 elements is\", array"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Contents of array of size 10 elements is [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 18.3, Page number: 372"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Calculation\n",
+ "import numpy as np \n",
+ "\n",
+ "# hist indicates that there are 0 items in bin #0, 2 in bin #1, 4 in bin #3, 1 in bin #4\n",
+ "# bin_edges indicates that bin #0 is the interval [0,1), bin #1 is [1,2), ..., bin #3 is [3,4)\n",
+ "\n",
+ "hist, bin_edges = np.histogram([1, 1, 2, 2, 2, 2, 3], bins = range(5))\n",
+ "\n",
+ "\n",
+ "# Result\n",
+ "import matplotlib.pyplot as plt\n",
+ "plt.bar(bin_edges[:-1], hist, width=1) and plt.xlim(min(bin_edges), max(bin_edges))\n",
+ "plt.savefig('histogram.png')\n",
+ "\n",
+ "from IPython.core.display import Image \n",
+ "Image(filename='histogram.png')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "metadata": {},
+ "output_type": "pyout",
+ "png": "iVBORw0KGgoAAAANSUhEUgAAAyAAAAJYCAYAAACadoJwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAAPYQAAD2EBqD+naQAAIABJREFUeJzt3X9s1fW9+PHXqSiwcgEHGFoJjivgNuaGJQirXgLu7gJy\n0Vy1rb3DKXHD5KoENeCPqcR03kzznXIJkUXurFQb7i4V55zkqmyaGS8ysWxuc1iZVq5SfhlxuFIG\n5Xz/4NLdrrS0QN9t6eORNJN3P5/j63zylvHkfM5pJpvNZgMAACCBnK4eAAAA6D0ECAAAkIwAAQAA\nkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABI\nRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZ\nAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQE\nCAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEg\nAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgKkA+6///7I\nycmJ888/v13H79mzJ+bNmxfDhg2LAQMGxCWXXBKbNm3q5CkBAKD7ymSz2WxXD9ETfPDBB3HeeedF\nTk5OjBo1Kt588802jz906FD83d/9Xbz55puxaNGiGDJkSDzyyCPxP//zP/HGG2/E6NGjE00OAADd\nhwBpp6uvvjo++uij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u3Ly688MKoqKiIMWPGpBwZAAC6DQHS\nQS+99FKLtfLy8igvL2+xPnjw4FixYkWsWLEixWi9WmlpaVeP0OO4ZsfHdSMde400/L5Gan4QIacE\nv3l2nGt2fFw30rHXSMPva6QmQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZ\nAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQE\nCAAAkIwAAQAAkhEgAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEg\nAABAMgIEAABIRoAAAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoAA\nAADJCBAAACAZAQIAACQjQAAAgGQECAAAkIwAAQAAkhEgAABAMgIEAABIRoC04Xe/+10UFRXFueee\nG7m5uTFkyJAoLCyMysrKY577+OOPR05OzlG/du7cmWB6AADofvp09QDd2datW+PTTz+N6667LvLz\n86O+vj6qqqrimmuuidra2vjOd75zzMcoKyuLUaNGNVsbNGhQZ40MAADdmgBpw8yZM2PmzJnN1m68\n8caYMGFCPProo+0KkJkzZ0ZBQUFnjQgAAD2KW7A6KCcnJ0aMGBGnn356u47PZrOxd+/eaGxs7OTJ\nAACg+xMg7VBfXx+7d++OP/zhD/Hwww/H888/H4sWLWrXudOmTYtBgwZFbm5uXH755bFly5ZOnhYA\nALovt2C1w6233hqPPvpoRET06dMnli5dGvPmzWvznNzc3Jg7d25MmzYtBg4cGBs3boyHHnooCgsL\no7q6OkaMGJFidAAA6FYESDvccsstUVxcHNu2bYvKysq46aabon///nHttde2ek5RUVEUFRU1/fqy\nyy6L6dOnx5QpU+L++++P5cuXpxgdAAC6FQHSDuedd16cd955ERExZ86cmD59eixYsCCKi4ujf//+\n7X6ciy66KCZNmhTr1q1r87gFCxbE4MGDm62VlpZGaWlpx4cHAOC4rFq1KlatWtVsbc+ePV00zalD\ngByHK6+8Ml588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BasDcnJyYsSIEXH66ae3eVxVVVUMHz68KT4iIoYOHRrFxcXxzDPP\nxIEDBzp7VAAA6JYEyDHU19fH7t274w9/+EM8/PDD8fzzz8eiRYvaPGfTpk1RUFDQYn3ixIlRX18f\nNTU1nTUuAAB0awLkGG699dY466yzYsyYMXH77bfH0qVLY968eW2eU1dXF3l5eS3Wj6xt27atU2YF\nAIDuzntAjuGWW26J4uLi2LZtW1RWVsZNN90U/fv3j2uvvbbVcxoaGqJv374t1vv16xcREfv27eu0\neQEAoDsTIMdw3nnnxXnnnRcREXPmzInp06fHggULori4OPr373/Uc/r37x/79+9vsd7Q0ND0/bYs\nWLAgBg8e3GyttLQ0SktLj+cpAABwHFatWhWrVq1qtrZnz54umubUIUA66Morr4wXX3wx3n777Rg/\nfvxRj8nLyzvqbVZ1dXUREZGfn9/mv2PJkiVHfQ8JAADpHO0vgKurq2PChAldNNGpwXtAOujI7VM5\nOa1fuvHjx0d1dXVks9lm6xs2bIjc3NwYO3Zsp84IAADdlQBpxa5du1qsHThwICoqKmLIkCExbty4\niDj8qsbmzZvj4MGDTcddddVVsWPHjlizZk3T2u7du2P16tUxe/bsY36MLwAAnKrcgtWKefPmxd69\ne2PKlCmRn58f27dvj8rKyqipqYny8vI47bTTIiLizjvvjIqKiqitrY2RI0dGxOEAmTx5csydOzfe\neuutpp+Ens1m47777uvKpwUAAF1KgLTi6quvjh/+8IexfPny+Oijj2LgwIExadKkWLZsWXzta19r\nOi6TyUQmk2l2bk5OTqxduzYWLlwYS5cujX379sWFF14YFRUVMWbMmNRPBQAAug0B0oqSkpIoKSk5\n5nHl5eVRXl7eYn3w4MGxYsWKWLFiRWeMBwAAPZL3gAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQ\njAABAACSESAAAEAyAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAy\nAgQAAEhGgAAAAMkIEAAAIBkBAgAAJCNAAACAZAQIAACQjAABAACSESAAAEAyA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imDFjRnz2s5+NnJycWLlyZbvP76177USuW2/da6+//nrcdNNNMW7cuBgwYECcc845UVJS\nEu+88067zu+te+1Erltv3Wu/+93voqioKM4999zIzc2NIUOGRGFhYVRWtu8jY3vrXjuR69Zb99rR\n3H///ZGTkxPnn39+u47vrfvteHgFJIHrrrsunnrqqbjllltizJgxUV5eHpdeemm89NJLbX5826FD\nh2LWrFnx5ptvxqJFi5pu5Zo6dWq88cYbMXr06ITPIr3jvW5HlJWVxahRo5qtDRo0qLPG7XK7du2K\nsrKyOOecc2L8+PHx8ssvt3h1rjW9ea+dyHU7orfttQceeCDWr18fRUVF8eUvfznq6upi2bJlUVBQ\nEK+99lqMGzeu1XN78147ket2RG/ba1u3bo1PP/00rrvuusjPz4/6+vqoqqqKa665Jmpra+M73/lO\nq+f25r12ItftiN621/7aBx98EP/6r/8aubm57fr/hN68345Llk61YcOGbCaTyX7/+99vWmtoaMiO\nHj06W1hY2Oa5P/rRj7KZTCb71FNPNa3t2rUre+aZZ2b/+Z//udNm7g5O5LqVl5dnM5lM9o033ujs\nMbuV/fv3Z3fs2JHNZrPZjRs3ZjOZTHblypXtOrc377UTuW69da/993//d/bAgQPN1t55551sv379\nsnPmzGnz3N68107kuvXWvXY0jY2N2fHjx2dHjhzZ5nG9ea8dTXuvm712WElJSfbv//7vs1OnTs1+\n6UtfOubx9lvHuAWrk1VVVUWfPn1i3rx5TWt9+/aN66+/PtavXx8ffvhhm+cOHz48rrjiiqa1oUOH\nRnFxcTzzzDNx4MCBTp29K53IdTsim83G3r17o7GxsTNH7TbOOOOMOOussyLi8HPviN68107kuh3R\n2/baV7/61ejTp/kL6KNHj44vfvGLsXnz5jbP7c177USu2xG9ba8dTU5OTowYMeKYnyjZm/fa0bT3\nuh3Rm/faL37xi3jqqadiyZIlLX6kQmvst44RIJ1s06ZNMXbs2BgwYECz9YkTJ0ZExK9+9as2zy0o\nKGixPnHixKivr4+ampqTO2w3ciLX7Yhp06bFoEGDIjc3Ny6//PLYsmVLp8x6KujNe+1ksNcO/2Fl\nx44dMXTo0DaPs9eaa+91O6K37rX6+vrYvXt3/OEPf4iHH344nn/++Vi0aFGb59hrx3fdjuite62x\nsTFuvvnm+Pa3v92u2yKPsN86xntAOlldXV3k5eW1WD+ydrSfmP5/z506dWqb53bkP46e5ESuW25u\nbsydOzemTZsWAwcOjI0bN8ZDDz0UhYWFUV1dHSNGjOi0uXuq3rzXToS99heVlZWxbdu2+O53v9vm\ncfZac+29br19r916661NP5erT58+sXTp0mavkB+NvXZ8162377Uf/OAHsXXr1vj5z3/eofPst44R\nIJ1s37590bdv3xbr/fr1a/p+axoaGo773J7uRK5bUVFRFBUVNf36sssui+nTp8eUKVPi/vvvj+XL\nl5/8gXu43rzXToS9dtjmzZvjxhtvjMLCwrj22mvbPNZe+4uOXLfevtduueWWKC4ujm3btkVlZWXc\ndNNN0b9//zavm712fNetN++1jz76KO6999649957Y8iQIR06137rGAHSyfr37x/79+9vsd7Q0ND0\n/c44t6c72c/9oosuikmTJrX74497m96810623rbXtm/fHrNmzYozzzwzqqqqjnmvtL12WEev29H0\npr123nnnxXnnnRcREXPmzInp06fHggULori4uNU9Y68d33U7mt6y1+6+++4YOnRo3HzzzR0+137r\nGO8B6WR5eXlHvV2orq4uIiLy8/M75dyerjOe+4gRI+Ljjz8+4dlORb15r3WG3rLXPvnkk5g5c2b8\n8Y9/jP/6r/+K4cOHH/Mce+34rltreste+2tXXnllfPLJJ/H222+3eoy91lJ7rltrTvW99s4778SK\nFSvi5ptvjg8++CBqa2ujtrY2Ghoa4s9//nO8//77bT5/+61jBEgnu+CCC6Kmpib27t3bbH3Dhg0R\nETF+/PhWzx0/fnxUV1e3+GSeDRs2RG5ubowdO/bkD9xNnMh1a827774bw4YNOynznWp6817rDL1h\nrzU0NMTs2bNjy5Yt8dOf/jQ+//nPt+u83r7Xjve6taY37LWjOXI7S05O63+M6e177Wjac91ac6rv\ntQ8//DAOHToU8+fPj7/9279t+vrlL38ZNTU1MWrUqCgrK2v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JIR\nIAAAQDICBAAASEaAAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaA\nAAAAyQgQAAAgGQECAAAkI0AAAIBkBAgAAJCMAAEAAJIRIAAAQDICBAAASEaAAAAAyQgQAAAgmf8P\npDpIO5V4wm8AAAAASUVORK5CYII=\n",
+ "prompt_number": 5,
+ "text": [
+ "<IPython.core.display.Image at 0x5a46130>"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_19_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_19_1.ipynb
new file mode 100755
index 00000000..00ddd7e8
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_19_1.ipynb
@@ -0,0 +1,197 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:4ee1b1671641fa0922389d9bf11b94f42d9755534b4f0476bbe2f9ceb3b1bc7e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 19: Ancient compilers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 19.1, Page number: 385"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def area (width, height) :\n",
+ " return width * height\n",
+ "\n",
+ "# Calculation and result\n",
+ "size = area (3.0, 2)\n",
+ "print ('Area is %f\\n' % size)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area is 6.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 19.2, Page number: 386"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def square (s) :\n",
+ " return s * s\n",
+ "\n",
+ "# Calculation and result\n",
+ "i = square (5)\n",
+ "print ('i is %d\\n' % i)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "i is 25\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 19.3, Page number: 386"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def sum (i1, i2, i3) :\n",
+ " return i1 + i2 + i3\n",
+ "\n",
+ "# Calculation and result\n",
+ "print ('Sum is %d\\n' % sum (1, 2, 3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sum is 6\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 19.4, Page number: 387"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "first = 'John'\n",
+ "last = 'Doe'\n",
+ "\n",
+ "# Calculation and result\n",
+ "full = first + ' ' + last\n",
+ "print ('The name is %s\\n' % full)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The name is John Doe\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 19.5, Page number: 390"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Function declaration\n",
+ "def area (width, height) :\n",
+ " return width * height\n",
+ "\n",
+ "# Calculation and result\n",
+ "size = area (3.0, 2.0)\n",
+ "print ('Area is %f\\n' % size)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Area is 6.000000\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_21_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_21_1.ipynb
new file mode 100755
index 00000000..144ac453
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_21_1.ipynb
@@ -0,0 +1,65 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:519d4be291344b242a6ae999f129aea597642f5315e1fe947ec2b9d627dcc018"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 21: C's dustier corners"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 21.1, Page number: 401"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "import sys\n",
+ "line = 'a'\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (line == 'a') :\n",
+ " print ('Add\\n')\n",
+ "elif (line == 'd') :\n",
+ " print ('Delete\\n')\n",
+ "elif (line == 'q') :\n",
+ " print ('Quit\\n')\n",
+ " sys.exit(1) \n",
+ "else :\n",
+ " print ('Error:Bad command %c\\n' % line)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Add\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_23_1.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_23_1.ipynb
new file mode 100755
index 00000000..bde77ef6
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_23_1.ipynb
@@ -0,0 +1,59 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:456077e76cba45d73549d009e1de5e86e8fe318cfd47c138325bf27f45638790"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 23: Programming adages"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 23.1, Page number: 447"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "number = 2\n",
+ "\n",
+ "# Calculation and result\n",
+ "if (number != 2) :\n",
+ " print ('Number is not two\\n')\n",
+ "else :\n",
+ " print ('Number is two\\n')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Number is two\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_2_3.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_2_3.ipynb
new file mode 100755
index 00000000..d166fe06
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_2_3.ipynb
@@ -0,0 +1,1112 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:69b330a048da570dabedd3e4e55c16ec334a711968bec2056bd27ef834d8f06e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2:. Convective Mass Transfer"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.1,Page number94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "T = 310 \t\t\t\t\t# [K]\n",
+ "\t# Since the solubility of oxygen in water at 310 K is extremely low, we are dealing with \tdilute solutions\n",
+ "k_L = 3.3*10**-5 \t\t\t\t# [coefficient based on the oxygen concentration \t\t\t\t\t\tdifference in the water, m/s]\n",
+ "row = 993 \t\t\t\t\t# [kg/cubic m]\n",
+ "M_b = 18 \t\t\t\t\t# [gram/mole]\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ " \n",
+ "\t# Since we are dealing with very dilute solutions\n",
+ "\t# Therefore, c = (row/M_avg) = row/M_b\n",
+ "c = row/M_b \t\t\t\t\t# [kmole/cubic m]\n",
+ "\t# Using equation 2.10\n",
+ "k_x = k_L*c \t\t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is\",round(k_x,5),\" kmole/square m.s\" \n",
+ "\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mass-transfer coefficient based on the mole fraction of oxygen in the liquid is 0.00182 kmole/square m.s\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.2,Page number:95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "\t# a-ammonia b-air\n",
+ "T = 300 \t\t\t\t\t# [K]\n",
+ "P = 1 \t\t\t\t\t\t# [atm]\n",
+ "y_a1 = 0.8 \t\t\t\t\t# [ammonia mole fraction in the bulk of the gas \t\t\t\t\t\t\tphase]\n",
+ "y_a2 = 0.732 \t\t\t\t\t# [ammonia gas-phase mole fraction on interface]\n",
+ "N_a = 4.3*10**-4 \t\t\t\t# [ammonia flux, kmole/square m.s]\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "import math\n",
+ "\t# Using equation 2.2\n",
+ "F_g = N_a/math.log10((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is\",round(F_g,5),\" kmole/square m.s\"\n",
+ "print\"\\n\\nNOTE:Calculation mistake in book:\\nAnswer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mass-transfer coefficient in the gas phase at that point where flux is 4.3*10**-4 is 0.00338 kmole/square m.s\n",
+ "\n",
+ "\n",
+ "NOTE:Calculation mistake in book:\n",
+ "Answer written as 1.47*10^-4,Actually,,...it is 1.47*10^-3.Please REDO last calculation manually to check\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.3,Page number:96"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "#Variable declaration\n",
+ "\n",
+ "\t\t# a-methanol b-water\n",
+ "P = 101.3 \t\t\t\t\t\t# [kPa]\n",
+ "y_a1 = 0.707 \t\t\t\t\t\t# [mole fraction at interface]\n",
+ "y_a2 = 0.656 \t\t\t\t\t\t# [mole fraction at bulk of the gas]\n",
+ "k_g = 1.62*10**-5 \t\t\t\t\t# [mass-transfer coefficient at a point \t\t\t\t\t\t\t in the column, kmole/square m.s.kPa]\n",
+ "#Calculations\n",
+ "\n",
+ "\t# Using equation 2.14\n",
+ "k_y = k_g*P \t\t\t\t\t\t# [kmole/square m.s]\n",
+ "\t# Using equation 2.12\n",
+ "N_a = k_y*(y_a1-y_a2) \t\t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The methanol flux at the point of given mass transfer coefficient is\",round(N_a,7),\"kmole/square m.s\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The methanol flux at the point of given mass transfer coefficient is 8.37e-05 kmole/square m.s\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.4,Page number:99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "n = 6 # [number of variables]\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "from scipy.optimize import fsolve\n",
+ "from numpy import *\n",
+ "import math\n",
+ "# To determine the number of dimensionless parameters to be formed, we must know the rank, r, of the dimensional matrix.\n",
+ "# The dimensional matrix is \n",
+ "DM =matrix([[0,0,1,1,0,0],[1,1,-3,-1,2,1],[-1,-1,0,0,-1,-1]]) \n",
+ "rk= linalg.matrix_rank(DM)\n",
+ "print\"Rank of matrix is \",rk \n",
+ "\n",
+ "#The numbers in the table represent the exponent of M, L, and t in the dimensional expression of each of the six variables involved. For example, the dimensional expression of p is M/Lt hence the exponents are 1, -1, and -1\n",
+ "\n",
+ "# From equation 2.16\n",
+ "i = n-rk # [number of dimensional groups]\n",
+ "# Let the dimensional groups are pi1, pi2 and pi3\n",
+ "# Therefore pi1 = (D_AB)**a*(row)**b*(D)**c*kc\n",
+ "# pi2 = (D_AB)**d*(row)**e*(D)**f*v\n",
+ "# pi3 = (D_AB)**g*(row)**h*(D)**i*u\n",
+ "\n",
+ "# Solving for pi1\n",
+ "# M**0*L**0*t**0 = 1 = (L**2/t)**a*(M/L**3)**b*(L)**c*(L/t)\n",
+ "\n",
+ "# Solution of simultaneous equation\n",
+ "def F(e):\n",
+ " f1 = 2*e[0]-3*e[1]+e[2]+1 \n",
+ " f2 = -e[0]-1 \n",
+ " f3 = -e[1] \n",
+ " return(f1,f2,f3)\n",
+ "\n",
+ "\n",
+ "# Initial guess:\n",
+ "e = [0.1,0.8,0.5] \n",
+ "y = fsolve(F,e) \n",
+ "a = y[0] \n",
+ "b = y[1] \n",
+ "c = y[2] \n",
+ "print\"The coefficients of pi1 are\",a,round(b),c \n",
+ "# Similarly the coefficients of pi2 and pi3 are calculated\n",
+ "# Therefore we get pi1 = kc*D/D_AB = Sh i.e. Sherwood Number\n",
+ "# pi2 = v*D/D_AB = P_ed i.e. Peclet Number\n",
+ "# pi3 = u/(row*D_AB) = Sc i.e. Schmidt Number\n",
+ "\n",
+ "# Dividing pi2 by pi3 gives\n",
+ "# pi2/pi3 = D*v*row/u = Re i.e. Renoylds number\n",
+ "\n",
+ "print\"The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\\n Sh = function(Re,Sc)\\n which is analogous to the heat transfer correlation \\n Nu = function(Re,Pr)\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rank of matrix is 3\n",
+ "The coefficients of pi1 are -1.0 0.0 1.0\n",
+ "The result of the dimensional analysis of forced-convection mass transfer in a circular conduit indicates that a correlating relation could be of the form\n",
+ " Sh = function(Re,Sc)\n",
+ " which is analogous to the heat transfer correlation \n",
+ " Nu = function(Re,Pr)\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.6,Page number:111"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "M_a = 352 \t\t\t\t\t# [molecular weight of UF6, gram/mole]\n",
+ "M_b = 29 \t\t\t\t\t# [gram/mole]\n",
+ "d = 0.01 \t\t\t\t\t# [diameter, m]\n",
+ "x = 0.1 \t\t\t\t\t# [length exposed to air stream, m]\n",
+ "v = 1 \t\t\t\t\t\t# [m/s]\n",
+ "Ts = 303 \t\t\t\t\t# [surface temperature of solid, K]\n",
+ "P_a = 27 \t\t\t\t\t# [vapor pressure of UF6, kPa]\n",
+ "Tb = 325 \t\t\t\t\t# [bulk temperature of solid ,K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "import math\n",
+ "\n",
+ "y_a1 = P_a/P \t\t\t\t\t# [mole fraction at point 1]\n",
+ "y_a2 = 0 \t\t\t\t\t# [mole fraction at point 2]\n",
+ "\n",
+ "\t# Along the mass-transfer path-cylinder surface (point 1) to bulk air (point 2)\n",
+ "Tavg = (Ts+Tb)/2 \t\t\t\t# [K]\n",
+ "\n",
+ "\t# At point 1, the gas is saturated with UF6 vapor, while at point 2 the gas is virtually \tfree of UF6\n",
+ "\t# Therefore\n",
+ "Pavg = (P_a+0)/2 \t\t\t\t# [average partial pressure, kPa]\n",
+ "y_a = Pavg/P \t\t\t\t\t# [mole fraction of UF6]\n",
+ "\n",
+ "Mavg = M_a*y_a+M_b*(1-y_a) \t\t\t# [gram/mole]\n",
+ "row_avg = P*Mavg/(R*Tavg) \t\t\t# [kg/cubic m]\n",
+ "\n",
+ "\t# Parameter for c-O2, d-N2 and a-UF6\n",
+ "yi_c = 0.182 \n",
+ "yi_d = 0.685 \n",
+ "yi_a = 0.133 \n",
+ "Tc_c = 154.6 \t\t\t\t# [K]\n",
+ "Tc_d = 126.2 \t\t\t\t\t# [K]\n",
+ "Tc_a = 505.8 \t\t\t\t\t# [K]\n",
+ "Pc_c = 50.4 \t\t\t\t\t# [bar]\n",
+ "Pc_d = 33.9 \t\t\t\t\t# [bar] \n",
+ "Pc_a = 46.6 \t\t\t\t\t# [bar]\n",
+ "M_c = 32 \t\t\t\t# [gram/mole]\n",
+ "M_d = 28 \t\t\t\t\t# [gram/mole] \n",
+ "M_a = 352 \t\t\t\t\t# [gram/mole]\n",
+ "V_c = 73.4 \t\t\t\t# [cubic cm/mole]\n",
+ "V_d = 89.8 \t\t\t\t\t# [cubic cm/mole]\n",
+ "V_a = 250 \t\t\t\t\t# [cubic cm/mole]\n",
+ "Z_c = 0.288 \n",
+ "Z_d = 0.290 \n",
+ "Z_a = 0.277 \n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "\n",
+ "\t# From equation 2.52 and 2.53\n",
+ "Tcm = yi_c*Tc_c+yi_d*Tc_d+yi_a*Tc_a \t\t# [K]\n",
+ "Pcm = 10**6*R*Tcm*(yi_c*Z_c+yi_d*Z_d+yi_a*Z_a)/((yi_c*V_c+yi_d*V_d+yi_a*V_a)*100000) \t# [bar]\n",
+ "M_avg = yi_c*M_c+yi_d*M_d+yi_a*M_a \t\t# [gram/mole]\n",
+ "\n",
+ "\t# From equation 2.50\n",
+ "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t# [uP]**-1\n",
+ "\n",
+ "\t# From equation 2.51\n",
+ "Trm = Tavg/Tcm \n",
+ "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n",
+ "\t# From equation 2.49 \n",
+ "u = f_Trm/Em \t\t\t\t\t\t# [uP]\n",
+ "u = u*10**-7 \t\t\t\t\t\t# [viscosity, kg/m.s]\n",
+ "\n",
+ "Re = d*v*row_avg/u \t\t\t\t\t# [Renoylds number]\n",
+ "\n",
+ "\t\t# Diffusivity of UF6 vapors in air at 314 K and 1 atm from equation 1.49\n",
+ "D_ab = 0.0904 \t\t\t\t\t\t# [square cm/s]\n",
+ "\n",
+ "Sc = u/(row_avg*D_ab*10**-4) \t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "Sh_avg = 0.43 + 0.532*Re**0.5*Sc**0.31 \t\t# [Sherwood number]\n",
+ "\t\t# From equation 1.7\n",
+ "c = P/(R*Tavg) \t\t\t\t\t# [kmole/cubic m]\n",
+ "\t\t# From Table 2.1 \n",
+ "F_av = Sh_avg*D_ab*c*10**-4/d \t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "\t\t# From equation 2.2\n",
+ "N_avg = F_av*math.log((1-y_a2)/(1-y_a1)) \t\t# [kmole/square m.s]\n",
+ "S = 2*math.pi*d**2/4 +math.pi*d*x \t\t\t# [total surface area of the cylinder, \t\t\t\t\t\t\tsquare m]\n",
+ "\n",
+ "w_a = N_avg*S*M_a \t\t\t\t\t# [rate of sublimation of the solid, \t\t\t\t\t\t\tkg/s] \n",
+ "\n",
+ "#Result\n",
+ "print\"Rate of sublimation of a cylinder of UF6 is\",round(w_a,5),\"kg/s\\n\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Rate of sublimation of a cylinder of UF6 is 0.00023 kg/s\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.7,Page number:116"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import math\n",
+ "#Variable declaration\n",
+ "\n",
+ "\t# a-benzene b-nitrogen\n",
+ "T = 300 \t\t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "v =10 \t\t\t\t\t\t# [m/s]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "\n",
+ "n = -0.5 \n",
+ "\t# Data on the properties of C02 at 300 K and 1 bar\n",
+ "u = 1.5*10**-5 \t\t\t\t# [viscosity, P]\n",
+ "Pr = 0.77 \t\t\t\t\t# [Prandtl number]\n",
+ "Cp = 853 \t\t\t\t\t# [J/kg.K]\n",
+ "\t# Therefore\n",
+ "\t# b = 5.086*l**0.5\n",
+ "\t# j_D = j_H = f(Re) = 5.086*(l**0.5)*Re**-0.5\n",
+ "\t# From Table 2.1\n",
+ "\t# F = j_D*c*v/Sc**(2/3) = 5.086*(l**0.5)*c*v/(Re**0.5*Sc**(2/3)) = \t\t5.086*(row*v*u)**0.5/(Mavg*Sc**(2.0/3.0))\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "\t# Vapor pressure of benzene\n",
+ "P_a = math.exp(15.9008-(2788.51/(T-52.36))) \t# [mm of Hg]\n",
+ "P_a = P_a*101.3/760 \t\t\t\t\t# [kPa]\n",
+ "\n",
+ "\t# Parameter for a-benzene, b-nitrogen \n",
+ "yi_a = 0.07 \n",
+ "yi_b = 0.93 \n",
+ "Tc_a = 562.2 \n",
+ "Tc_b = 126.2 \t\t\t\t\t\t# [K]\n",
+ "Pc_a = 48.9 \n",
+ "Pc_b = 33.9 \t\t\t\t\t\t# [bar]\n",
+ "M_a = 78.1 \n",
+ "M_b = 28 \t\t\t\t\t\t# [gram/mole]\n",
+ "V_a = 259 \n",
+ "V_b = 89.8 \t\t\t\t\t\t# [cubic cm/mole]\n",
+ "Z_a = 0.271 \n",
+ "Z_b = 0.290 \n",
+ "sigma_a = 5.349 \n",
+ "sigma_b = 3.798 \t\t\t\t\t# [Angstrom]\n",
+ "ek_a = 412.3 \n",
+ "ek_b = 71.4 \t\t\t\t\t\t# [E/k, K]\n",
+ "\n",
+ "\n",
+ "\t# From equation 2.52 and 2.53\n",
+ "Tcm = yi_b*Tc_b+yi_a*Tc_a \t\t\t\t# [K]\n",
+ "Pcm = 10**6*R*Tcm*(yi_b*Z_b+yi_a*Z_a)/((yi_b*V_b+yi_a*V_a)*100000) \t # [bar]\n",
+ "M_avg = yi_b*M_b+yi_a*M_a \t\t\t\t\t\t# [kg/kmole]\n",
+ "\n",
+ "#RESULT\n",
+ "\n",
+ "print\"Average molecular weight is\",round(M_avg,1),\"kg/kmole\" \n",
+ "\n",
+ "row = P*M_avg/(R*T) \t\t\t\t\t\t\t# [kg/cubic m]\n",
+ "\n",
+ "#RESULT\n",
+ "\n",
+ "print\"Density of mixture is\",round(row,2),\"kg/cubic\"\n",
+ "\t# From equation 2.50\n",
+ "Em = 0.176*(Tcm/(M_avg**3*Pcm**4))**(1.0/6.0) \t\t\t# [uP]**-1\n",
+ "\n",
+ "\t# From equation 2.51\n",
+ "Trm = T/Tcm \n",
+ "f_Trm = (0.807*Trm**0.618)-(0.357*math.exp(-0.449*Trm))+(0.340*math.exp(-4.058*Trm))+0.018 \n",
+ "\t# From equation 2.49 \n",
+ "u = f_Trm/Em \t\t\t\t\t\t\t\t# [uP]\n",
+ "u = u*10**-7 \t\t\t\t\t\t\t\t# [viscosity, kg/m.s]\n",
+ "print\"Average viscosity of mixture is \",round(u,7),\"kg/m.s\\n\\n\" \n",
+ "\n",
+ "\t# Calculating diffusivity of benzene using equation 1.49\n",
+ "D_ab = 0.0986 \t\t\t\t\t\t\t\t# [square cm/s]\n",
+ "Sc = u/(row*D_ab*10**-4) \t\t\t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "F = 5.086*(row*v*u)**0.5/(M_avg*Sc**(2.0/3.0)) \t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "\n",
+ "#RESULT\n",
+ "\n",
+ "print\"The required mass transfer coefficient is\",round(F,5),\"kmole/square m.s\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Average molecular weight is 31.5 kg/kmole\n",
+ "Density of mixture is 1.28 kg/cubic\n",
+ "Average viscosity of mixture is 1.64e-05 kg/m.s\n",
+ "\n",
+ "\n",
+ "The required mass transfer coefficient is 0.00196 kmole/square m.s\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.8,Page number:120"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "T = 300 \t\t\t\t\t\t# [K]\n",
+ "l = 3 \t\t\t\t\t\t\t# [length of vertical plate, m]\n",
+ "b = 1.5 \t\t\t\t\t\t# [width of vertical plate, m]\n",
+ "P = 101.3 \t\t\t\t\t\t# [kPa]\n",
+ "v = 5 \t\t\t\t\t\t\t# [velocity across the width of plate, \t\t\t\t\t\t\tm/s]\n",
+ "row_a = 0.88 \t\t\t\t\t\t# [gram/cubic cm]\n",
+ "\n",
+ "\n",
+ "y_a1 = 0.139 \t\t\t\t\t\t# [mole fraction of benzene at inner \t\t\t\t\t\t\tedge]\n",
+ "y_a2 = 0 \n",
+ "\n",
+ "\t# The film conditions, and average properties, are identical to those in Example 2.7, \tonly the geometry is different\n",
+ "\t# Therefore\n",
+ "M_avg = 31.4 \t\t\t\t\t\t# [kg/kmole]\n",
+ "row = 1.2 \t\t\t\t\t\t# [kg/cubic m]\n",
+ "u = 161*10**-7 \t\t\t\t\t# [kg/m.s]\n",
+ "D_ab = 0.0986 \t\t \t\t\t\t# [square cm/s]\n",
+ "Sc = 1.3 \t\t\t\t\t\t# [Schmidt Number]\n",
+ "Re = row*v*b/u \t\t\t\t\t# [Renoylds Number]\n",
+ "\n",
+ "if Re > 4000:\n",
+ " print\"The flow across the plate is turbulent\\n\" \n",
+ "elif Re<2000:\n",
+ " print\"The flow across the plate is laminar\\n\" \n",
+ "\t#Using equation 2.57\n",
+ "Sh_l = 0.036*Re**0.8*Sc**(1.0/3.0) \n",
+ "\n",
+ "\t# Nitrogen (component B) does not react with benzene (component A), neither dissolves in \t\tthe liquid therefore, NB = 0 and siA = 1. The F-form of the mass-transfer coefficient \t\t\tshould be used \n",
+ "F = Sh_l*1.26*D_ab*10**-4/(M_avg*b) \t\t\t# [kmole/square m.s]\n",
+ "N_a = F*math.log((1-y_a2)/(1-y_a1)) \t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "\t# The total mass rate of evaporation over the surface of the plate\n",
+ "S = 1.5*3 \t\t\t\t\t\t# [square m]\n",
+ "M_a = 78.1 \t\t\t\t\t\t# [gram/mole]\n",
+ "wa = N_a*S*M_a*60*1000 \t\t\t\t# [gram/min]\n",
+ "\n",
+ "V = wa/row_a \t\t\t\t\t\t# [volumetric flow rate, ml/min]\n",
+ "\n",
+ "print\"Liquid benzene should be supplied at the top of the plate at the rate \",round(V),\"ml/min\\nso that evaporation will just prevent it from reaching the bottom of the plate.\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The flow across the plate is turbulent\n",
+ "\n",
+ "Liquid benzene should be supplied at the top of the plate at the rate 1473.0 ml/min\n",
+ "so that evaporation will just prevent it from reaching the bottom of the plate.\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.9,Page number:123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "dp1 = 10**-3 \t\t\t\t\t# [diameter of spherical drop of water, m]\n",
+ "Tair = 323 \t\t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "Twater = 293 \t\t\t\t\t# [K]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "M_a = 18.0 \t\t\t\t\t# [gram/mole]\n",
+ "M_b = 29.0 \t\t\t\t\t# [gram/mole]\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "dp2 = (1.0/2.0)**(1.0/3.0)*dp1 \t\t# [m]\n",
+ "dp = (dp1+dp2)/2 \t\t\t\t# [m]\n",
+ "\n",
+ "row_p = 995 \t\t\t\t\t# [density of water, kg/cubic m]\n",
+ "row1b = 1.094 \t\t\t\t\t# [density of air, kg/cubic m]\n",
+ "u = 1.95*10**-5 \t\t\t\t# [kg/m.s]\n",
+ "row_pr = row_p-row1b \t\t\t\t# [kg/cubic m]\n",
+ "g = 9.8 \t\t\t\t\t# [accleration due to gravity, square m/s]\n",
+ "\t# Combining equation 2.68 and 2.69\n",
+ "Ga = 4*dp**3*row1b*row_pr*g/(3*u**2) \t\t# [Galileo Number]\n",
+ "\n",
+ "\t# Relationship between Re and Cd\n",
+ "\t# Re/Cd = Re**3/Ga = 3*row**2*vt**3/(4*g*u*row_pr)\n",
+ "\n",
+ "\t# The following correlation is used to relate Re/Cd, to Ga\n",
+ "\t# ln(Re/Cd)**(1/3) = -3.194 + 2.153*ln(Ga)**(1/3) - 0.238*(ln(Ga)**(1/3))**2 + \t0.01068*(ln(Ga)**(1/3))**3\n",
+ "\t# Therefore let A = (Re/Cd)\n",
+ "A = math.exp(-3.194 + 2.153*math.log(Ga**(1.0/3.0)) - 0.238*(math.log(Ga**(1.0/3.0)))**2 + 0.01068*(math.log(Ga**(1.0/3.0)))**3) \n",
+ "\n",
+ "\t# Therefore 'vt' will be\n",
+ "vt = A*(4*g*row_pr*u/(3*row1b**2))**(1.0/3.0) \t# [Terminal velocity of particle, m/s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"Terminal velocity of particle is\",round(vt,2),\"m/s\" \n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "P_w = 2.34 \t\t\t\t\t# [vapor pressure of water, kPa]\n",
+ "y_w = P_w/P \t\t\t\t\t# [mole fraction of water at the inner edge of \t\t\t\t\t\tthe gas film]\n",
+ "M_avg = 18*y_w+29*(1-y_w) \t\t\t# [gram/mole]\n",
+ "\n",
+ "row2b = P*M_avg/(R*Twater) \t\t\t# [kg/cubic.m]\n",
+ "delta_row = row2b - row1b \t\t\t# [kg/cubic.m]\n",
+ "\n",
+ "Tavg = (Tair+Twater)/2 \t\t\t# [K]\n",
+ "\t\t# At Temperature equal to Tavg density and viscosity are\n",
+ "row3 = 1.14 \t\t\t\t\t# [kg/cubic.m]\n",
+ "u1 = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n",
+ "\n",
+ "Grd = g*row3*delta_row*(dp**3)/(u1**2) \n",
+ "\n",
+ "\t\t# Diffusivity of water at Tavg and 1 atm is\n",
+ "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n",
+ "Sc = u1/(row3*D_ab) \t\t\t\t# [Schmidt Number]\n",
+ "Re = dp*row3*vt/u1 \t\t\t\t# [Renoylds Number]\n",
+ "\t\n",
+ "\t# From equation 2.65 Re is greater than 0.4*Grd**0.5*Sc**(-1/6)\n",
+ "\t# Therfore equation 2.64 can be used to calculate mass transfer coefficient\n",
+ "\n",
+ "Sh = 2+0.552*(Re**0.5)*Sc**(1.0/3.0) \t\t# [Sherwood Number]\n",
+ "\t# From Table 2.1\n",
+ "\t# Sh = kc*P_bm*dp/(P*D_ab), since P_bm is almost equal to P\n",
+ "\t# Therefore \n",
+ "\t# Sh = kc*dp/D_ab \n",
+ "kc = Sh*D_ab/dp \t\t\t\t# [m/s]\n",
+ "\n",
+ "ca2 = 0 \t\t\t\t\t# [dry air concentration]\n",
+ "ca1 = P_w/(R*Twater) \t\t\t\t# [interface concentration, kmole/cubic.m]\n",
+ "\t# Average rate of evaporation \n",
+ "wa = math.pi*dp**2*M_a*kc*(ca1-ca2)*1000 \t# [g/s]\n",
+ "\n",
+ "\t# Amount of water evaporated\n",
+ "m = row_p*math.pi*dp1**3/12*1000 \t\t# [g]\n",
+ "\t# Time necessary to reduce the volume by 50%\n",
+ "t = m/wa \t\t\t\t\t# [s]\n",
+ "\n",
+ "D = t*vt \t\t\t\t\t# [distance of fall, m]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"The distance of fall is\",round(D),\"m\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Terminal velocity of particle is 3.59 m/s\n",
+ "The distance of fall is 90.0 m\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.10,Page number:127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Re = 1223 \t\t\t\t# [Renoylds Number]\n",
+ "Sc = 0.905 \t\t\t\t# [Schmidt Number]\n",
+ "c = 0.039 \t\t\t\t# [molar density, kg/cubic m]\n",
+ "v = 1 \t\t\t\t\t# [gas velocity, m/s]\n",
+ "\t# Therefore \n",
+ "#Calculations\n",
+ "\n",
+ "Gm = c*v \t\t\t\t# [kmole/square m.s]\n",
+ "\t# From equation 2.9 \n",
+ "\t# Kg*P = ky\n",
+ "\t# Therefore substituting in equation 2.73 we obtain\n",
+ "ky = 0.281*Gm/(Re**0.4*Sc**0.56) \t# [kmole/square m.s]\n",
+ "\t# Now equation 2.73 were obtained under very dilute concentrations\n",
+ "\t# Therefore\n",
+ "y_bm = 1 \n",
+ "\t# From equation 2.6\n",
+ "F = ky*y_bm \t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"Mass transfer coefficient is \",round(F,6),\"kmol/m.^2-s\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Mass transfer coefficient is 0.000675 kmol/m.^2-s\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.11,Page number:129"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "D = 25.4*10**-3 \t\t\t\t# [diameter of wetted wall tower, m]\n",
+ "Gy = 10 \t\t\t\t\t# [mass velocity, kg/square m.s]\n",
+ "T1 = 308 \t\t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "p_a1 = 1.95 \t\t\t\t\t# [partial pressure of water vapor, kPa]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "M_a = 18 \t\t\t\t\t# [gram/mole]\n",
+ "Cpa = 1.88 \t\t\t\t\t# [kJ/kg.K]\n",
+ "\n",
+ "\n",
+ "# Properties of dry air at 308 K and 1 atm pressure are\n",
+ "u = 1.92*10**-5 \t\t\t\t# [kg/m.s]\n",
+ "row = 1.14 \t\t\t\t\t# [kg/cubic m]\n",
+ "D_ab = 0.242*10**-4 \t\t\t\t# [square m/s]\n",
+ "Sc = 0.696 \t\t\t\t\t# [Schmidt number]\n",
+ "Cp = 1.007 \t\t\t\t\t# [kJ/kg.K]\n",
+ "k = 0.027 \t\t\t\t\t# [W/m.K]\n",
+ "Pr = 0.7 \t\t\t\t\t# [Prandtl number]\n",
+ "\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "import math\n",
+ "from scipy.optimize import fsolve\n",
+ "from numpy import *\n",
+ "\n",
+ "Re = D*Gy/u \t\t\t\t\t# [Renoylds number]\n",
+ "# From equation 2,74\n",
+ "Sh = 0.023*Re**0.83*Sc**0.44 \t\t\t#[Sherwood number]\n",
+ "# From Table 2.1\n",
+ "kg = Sh*D_ab/(R*T1*D)*1000 \t\t\t# [mole/square m.s.kPa]\n",
+ "\n",
+ "# To estimate the heat-transfer coefficient, we use the Dittus-Boelter equation for cooling, equation 2.80\n",
+ "Nu = 0.023*Re**0.8*Pr**0.3 \t\t\t# [Nusselt number]\n",
+ "# From Table 2.1\n",
+ "h = Nu*k/D \t\t\t\t\t# [W/square m.K]\n",
+ "\n",
+ "T =373.15 \t\t\t\t\t# [K]\n",
+ "lambda_a = 40.63 \t\t\t\t# [kJ/mole]\n",
+ "Tc = 647.1 \t\t\t\t\t# [K]\n",
+ "\n",
+ "# Solution of simultaneous equation 2.78 and 2.79\n",
+ "def F(e): \n",
+ " f1=kg*(p_a1 - math.exp(16.3872-(3885.7/(e[0]-42.98))))-e[1] \n",
+ " f2=e[1]*M_a*Cpa*(T1-e[0])/(1-exp(-e[1]*M_a*Cpa/h)) + 1000*e[1]*lambda_a*((1-(e[0]/Tc))/(1-(T/Tc)))**0.38 \n",
+ " return(f1,f2) \n",
+ "\n",
+ "\n",
+ "# Initial guess\n",
+ "e = [292,-0.003] \n",
+ "y = fsolve(F,e) \n",
+ "Ti = y[0] \n",
+ "Na = y[1] \n",
+ "\n",
+ "print\"The temperature of the liquid water and the rate of water evaporation is\",round(Ti),\"K and\",round(Na,3),\" mole/square m.s respectively\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature of the liquid water and the rate of water evaporation is 295.0 K and -0.013 mole/square m.s respectively\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.12,Page number:131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n",
+ "Z = 1.5 \t\t\t\t# [length of the wetted section, m]\n",
+ "Gy = 10 \t\t\t\t# [mass velocity of air, kg/square m.s]\n",
+ "Tair = 308 \t\t\t\t# [K]\n",
+ "Twater = 295 \t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t# [kPa]\n",
+ "M_a = 18.0 \t\t\t\t# [gram/mole]\n",
+ "M_b = 29.0 \t\t\t\t# [gram/mole]\n",
+ "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "#Calculations\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "Pa = 2.64 # [kPa]\n",
+ "\n",
+ "Gm = Gy/M_b \t# [Assuming that gas phase is basically dry air, kmole/square m.s]\n",
+ "\t\t# The properties of dry air at 308 K and 1 atm are (from example 2.9)\n",
+ "row = 1.14 \t\t\t\t# [kg/cubic m]\n",
+ "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n",
+ "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n",
+ "Sc = 0.692 \t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "Re = Gy*D/u \t\t\t\t# [Renoylds number]\n",
+ "\n",
+ "if Re<35000 and Re>2000:\n",
+ " Sh = 0.023*Re**0.83*Sc**0.44 \t# [Sherwood number] \n",
+ " print\"Sherwood number is\",round(Sh,1) \n",
+ "else:\n",
+ " print\"We cannot use equation 2.74\"\n",
+ "\n",
+ "c = P/(R*Tair) \t\t\t# [kmole/cubic m]\n",
+ "\t# Now using equation 2.89\n",
+ "Pa_out = Pa*(1-math.exp((-4*Sh*Z*c*D_ab)/(Gm*D**2))) \t\t# [kPa]\n",
+ "\n",
+ "#Result\n",
+ "print\"The partial pressure of water in the air leaving the tower is\",round(Pa_out,2),\"kPa\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Sherwood number is 51.6\n",
+ "The partial pressure of water in the air leaving the tower is 1.94 kPa\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.13,Page number:134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "Gy = 10.0 \t\t\t\t# [kg/square m.s]\n",
+ "dp = 3.5*10**-3 \t\t\t# [diameter of spherical glass beads, m]\n",
+ "D = 25.4*10**-3 \t\t\t# [Internal diameter of tower, m]\n",
+ "Tair = 308 \t\t\t\t# [K]\n",
+ "Twater = 295 \t\t\t\t# [K]\n",
+ "P = 101.3 \t\t\t\t# [kPa]\n",
+ "M_a = 18 \t\t\t\t# [gram/mole]\n",
+ "M_b = 29 \t\t\t\t# [gram/mole]\n",
+ "R = 8.314 \t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "import math\n",
+ "from scipy.optimize import fsolve\n",
+ "\t# The properties of dry air at 308 K and 1 atm are (from example 2.12)\n",
+ "row = 1.14 \t\t\t\t# [kg/cubic m]\n",
+ "u = 1.92*10**-5 \t\t\t# [kg/m.s]\n",
+ "D_ab = 0.242*10**-4 \t\t\t# [square m/s]\n",
+ "Sc = 0.692 \t\t\t\t# [Schmidt number]\n",
+ "c = 0.04 \t \t\t\t# [mole/cubic m]\n",
+ "Gm = 0.345 \t\t\t\t# [kmole/square m.s]\n",
+ "\n",
+ "Re = Gy*dp/u \t\t\t\t# [Renoylds number]\n",
+ "if Re<2500 and Re>10:\n",
+ " \t\t\t\t\t# Subsituting in equation 2.90\n",
+ " jd = 1.17*Re**-0.415 \n",
+ " print\"Renoylds number is \",Re\n",
+ "else:\n",
+ " print \" \"\n",
+ "Std = 0.052/(Sc**(2.0/3.0)) \n",
+ "\t\t# From Table 2.1 \n",
+ "Sh = Std*Re*Sc \t\t\t# [Sherwood number]\n",
+ "\t\t# From equation 2.94\n",
+ "e = 0.406+0.571*(dp/D) \t\t# [bed porosity]\n",
+ "e=round(e,3)\n",
+ "\t#Illustration 2.13(a) \n",
+ "\t# Solution(a)\n",
+ "\t# Now Paout = 0.99*Pa\n",
+ "\t# Using equation 2.93 to calculate 'Z'\n",
+ "def f12(Z):\n",
+ " return(0.99 - 1 + math.exp(-6*(1-e)*Sh*c*Z*D_ab/(Gm*dp**2))) \n",
+ "Z = fsolve(f12,0.06) \n",
+ "\n",
+ "#Result\n",
+ "Z=round(Z[0],3)\n",
+ "print\"The depth of packing required is\",Z,\"m=\",Z*100,\"cm\" \n",
+ "\n",
+ "\t#Illustration 2.13(b)\n",
+ "\t# Solution(b)\n",
+ "\t# From equation 2.95\n",
+ "deltaP = (150*(1-e)/Re + 1.75)*((1-e)*(Gy**2)*Z)/(dp*row*e**3) \t# [Pa]\n",
+ "\n",
+ "#Result\n",
+ "print\"The gas pressure drop through the bed is\",round(deltaP),\"Pa (Approx) \\nDUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\\niF DONE MANUALLY,THIS ANSWER STANDS CORRECT\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Renoylds number is 1822.91666667\n",
+ "The depth of packing required is 0.078 m= 7.8 cm\n",
+ "The gas pressure drop through the bed is 15817.0 Pa (Approx) \n",
+ "DUE TO LACK OF PRECISION IN CALCULATION IN BOOK.\n",
+ "iF DONE MANUALLY,THIS ANSWER STANDS CORRECT\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.14,Page number:138"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "m = 40000.0 \t\t\t\t\t# [kg/hr]\n",
+ "Twater = 298 \t\t\t\t\t# [K]\n",
+ "v = 0.1 \t\t\t\t\t# [superficial velocity, m/s]\n",
+ "P = 101.3 \t\t\t\t\t# [kPa]\n",
+ "V = 40*10**-3 \t\t\t\t\t# [Flow rate of nitrogen, cubic m/min]\n",
+ "d = 2.90*10**-4 \t\t\t\t# [Outside diameter of fibres, m]\n",
+ "pf = 0.4 \t\t\t\t\t# [Packing factor]\n",
+ "a = 46.84*100 \t\t\t\t\t# [surface area per unit volume, m**-1]\n",
+ "R = 8.314 \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "dw = 1000 \t\t\t\t\t# [density of water, kg/cubic m]\n",
+ "Ql = m/(3600*1000) \t\t\t\t# [volumetric water flow rate, cubic m/s]\n",
+ "\t# Shell diameter\n",
+ "D = (4*Ql/(math.pi*v))**0.5 \t\t\t# [Shell diameter, m]\n",
+ "\n",
+ "\t# the properties of dilute mixtures of oxygen in water at 298 K\n",
+ "u = 0.9 \t\t\t\t\t# [cP]\n",
+ "\t# Diffusivity from equation 1.53\n",
+ "D_ab = 1.93*10**-9 \t\t\t\t# [square m/s]\n",
+ "Sc = 467 \t\t\t\t\t# [Schmidt number]\n",
+ "\n",
+ "Re = d*v*dw/(u*10**-3) \t\t\t# [Renoylds number]\n",
+ "\n",
+ "\t# Substituting in equation (2-97) gives\n",
+ "Sh = 0.53*(1-1.1*pf)*((1-pf)/pf)**-0.47*(Re**0.53*Sc**0.33) \n",
+ "\n",
+ "kl = Sh*D_ab/d \t\t\t\t# [mass-transfer coefficient on the shell side, \t\t\t\t\t\tm/s]\n",
+ "\n",
+ "\t# From the specified BFW flow rate\n",
+ "L = m/(3600*18) \t\t\t\t# [kmole/s]\n",
+ "\t# From ideal gas law\n",
+ "V1 = V*P/(Twater*R*60) \t\t\t# [kmole/s]\n",
+ "\t# From the solubility of oxygen in water at 298 K,\n",
+ "M = 4.5*10**4 \n",
+ "A = L/(M*V1) \t\t\t\t\t# [Absorption factor]\n",
+ "\n",
+ "#Result\n",
+ "\n",
+ "print\"Absorption factor is\",round(A,3) \n",
+ "\n",
+ "#Calculation\n",
+ "\n",
+ "\t# For 99% removal of the dissolved oxygen\n",
+ "\t# x_in/x_out = b = 100\n",
+ "b = 100 \n",
+ "c = 55.5 \t\t\t\t\t# [molar density, kmole/cubic m]\n",
+ "\t# Substituting in equation 2.99 yields\n",
+ "V_T = (L*math.log(b*(1-A)+A))/(kl*a*c*(1-A)) \t # [cubic m]\n",
+ "\n",
+ "\t# The module length, Z is\n",
+ "Z = V_T/(math.pi*D**2.0/4.0) \n",
+ "\n",
+ "#Result\n",
+ "print\"The shell diameter and module length is\",round(D,3),\"m and\",round(Z,2),\" m respectively\" "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Absorption factor is 0.503\n",
+ "The shell diameter and module length is 0.376 m and 2.15 m respectively\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 2.15,Page number:140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=2.21/100\t\t\t#[m]\n",
+ "mu=8.82*10**-6\t\t#[kg/m-s]\n",
+ "rho=2.81\t\t#[kg/m**3]\n",
+ "\n",
+ "c=34.14\t\t\t#[mol/m**3]\n",
+ "D=array([2.228/(10**6),2.065/(10**6),1.832/(10**6)]) #Velocities in [m**2/s]\n",
+ "\n",
+ "\n",
+ "#Calculation\n",
+ "#Gy=rho*v\t\t\n",
+ "#Re=Gy*d/mu\t\t#Reynolds number\n",
+ "Re=21750\n",
+ "print \"Reynolds number=\",Re\n",
+ "Sc=[]\n",
+ "Sh=[]\n",
+ "F=[]\n",
+ "for i in range(0, 3):\n",
+ " sc=mu/(rho*D[i]) #Schmidt number\n",
+ " Sc.append(sc)\n",
+ " sh=0.023*Re**(0.83)*sc**(0.44) #Sherwood number\n",
+ " Sh.append(sh)\n",
+ " f=sh*c*D[i]/d #Binary mass transfer coefficient in [mol/m^2-s]\n",
+ " F.append(f)\n",
+ "print \"Schmidt number are:\"\n",
+ "for i in range(0,3):\n",
+ " print round(Sc[i],3)\n",
+ "print \"Sherwood number number are:\"\n",
+ "for i in range(0,3):\n",
+ " print round(Sh[i],1)\n",
+ "print\"Binary mass transfer coefficients are:\"\n",
+ "for i in range(0,3):\n",
+ " print round(F[i],3)\n",
+ "#After modifying mathcad program of example 1.17,we have\n",
+ "N1=-0.0527 #[mol/m^2-s]\n",
+ "N2=0.0395 #[mol/m^2-s]\n",
+ "N3=0.0132 #[mol/m^2-s]\n",
+ "print\"The program yields the following results:\"\n",
+ "print \"N1=\",N1,\"mol/m**2-s\"\n",
+ "print \"N2=\",N2,\"mol/m**2-s\"\n",
+ "print \"N3=\",N3,\"mol/m**2-s\"\n",
+ " "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reynolds number= 21750\n",
+ "Schmidt number are:\n",
+ "1.409\n",
+ "1.52\n",
+ "1.713\n",
+ "Sherwood number number are:\n",
+ "106.5\n",
+ "110.1\n",
+ "116.1\n",
+ "Binary mass transfer coefficients are:\n",
+ "0.367\n",
+ "0.351\n",
+ "0.328\n",
+ "The program yields the following results:\n",
+ "N1= -0.0527 mol/m**2-s\n",
+ "N2= 0.0395 mol/m**2-s\n",
+ "N3= 0.0132 mol/m**2-s\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_3_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_3_4.ipynb
new file mode 100755
index 00000000..a8e0779c
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_3_4.ipynb
@@ -0,0 +1,53 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:ebedd6f3bf7c0762de88b2ec9ed84eecba39a72a5c5924ff89534f9517007ca4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 3: Style"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 3.1, Page number: 57"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "\n",
+ "print ('Hello World')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Hello World\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_4_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_4_4.ipynb
new file mode 100755
index 00000000..8602f989
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_4_4.ipynb
@@ -0,0 +1,258 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:785237ffc865ddc47952e10309b1bb53ee1543217e833069c02c2afb50bff287"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 4: Basic declarations and expressions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.1, Page number: 71"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "x = (1 + 2) * 4\n",
+ "\n",
+ "# Result\n",
+ "print ('1 plus 2 multiplied by 4 gives %d' % x)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1 plus 2 multiplied by 4 gives 12\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.2, Page number: 75"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "term = 3 * 5\n",
+ "term_2 = 2 * term\n",
+ "term_3 = 3 * term\n",
+ "\n",
+ "# Result\n",
+ "print ('Twice %d is %d' % (term, term_2))\n",
+ "print ('Three times %d is %d' % (term, term_3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Twice 15 is 30\n",
+ "Three times 15 is 45\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.3, Page number: 77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "term = 3 * 5\n",
+ "term_2 = 2 * term\n",
+ "term_3 = 3 * term\n",
+ "\n",
+ "# Result\n",
+ "print ('Twice %d is %d' % (term, term_2))\n",
+ "print ('Three times %d is %d' % (term, term_3))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Twice 15 is 30\n",
+ "Three times 15 is 45\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.4, Page number: 79"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "answer = 1/3\n",
+ "\n",
+ "# Result\n",
+ "print ('The value of 1/3 is %f' % answer)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of 1/3 is 0.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.5, Page number: 80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "answer = 2 + 2\n",
+ "\n",
+ "# Result\n",
+ "print ('The answer is %d' % answer)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The answer is 4\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.6, Page number: 80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "result = 7.0/22.0\n",
+ "\n",
+ "# Result\n",
+ "print ('The result is %d' % result)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The result is 0\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 4.7, Page number: 82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "char1 = 'A'\n",
+ "char2 = 'B'\n",
+ "char3 = 'C'\n",
+ "\n",
+ "# Result\n",
+ "print ('%c%c%c reversed is %c%c%c' % (char1, char2, char3, char3, char2, char1))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "ABC reversed is CBA\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_5_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_5_4.ipynb
new file mode 100755
index 00000000..2d2abf16
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_5_4.ipynb
@@ -0,0 +1,404 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:8925a816cb9ea05a6a48e6ec88b1e1778772a9e1e429803a5c922fb000f7f30d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 5: Arrays, qualifiers, and reading numbers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.1, Page number: 84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "data = [ 34.0, 27.0, 45.0, 82.0, 22.0 ]\n",
+ "\n",
+ "# Calculation\n",
+ "total = data[0] + data[1] + data[2] + data[3] + data[4]\n",
+ "average = total/5.0\n",
+ "\n",
+ "# Result\n",
+ "print ('Total %f Average %f' % (total, average))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total 210.000000 Average 42.000000\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.2, Page number: 87"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "name = 'Sam'\n",
+ "\n",
+ "# Result\n",
+ "print ('The name is %s' % name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The name is Sam\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.3, Page number: 88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "first = 'Steve'\n",
+ "last = 'Oualline'\n",
+ "\n",
+ "# Calculation\n",
+ "full_name = first + ' ' + last\n",
+ "\n",
+ "# Result\n",
+ "print ('The full name is %s' % full_name)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The full name is Steve Oualline\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.4, Page number: 89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "line = 'hello world'\n",
+ "\n",
+ "# Result\n",
+ "print ('The length of the line is %d' % len(line))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The length of the line is 11\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.5, Page number: 90"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "first = 'Steve'\n",
+ "last = 'Oualline'\n",
+ "\n",
+ "# Calculation\n",
+ "full = first + ' ' + last\n",
+ "\n",
+ "# Result\n",
+ "print ('The name is %s' % full)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The name is Steve Oualline\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.6, Page number: 91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "first = 'Steve'\n",
+ "last = 'Oualline'\n",
+ "\n",
+ "# Calculation\n",
+ "full = first + ' ' + last\n",
+ "\n",
+ "# Result\n",
+ "print ('The name is %s' % full)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The name is Steve Oualline\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.7, Page number: 93"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "array = [[0 for x in range(5)] for x in range(5)]\n",
+ "array[0][0] = 0 * 10 + 0\n",
+ "array[0][1] = 0 * 10 + 1\n",
+ "array[1][0] = 1 * 10 + 0\n",
+ "array[1][1] = 1 * 10 + 1\n",
+ "array[2][0] = 2 * 10 + 0\n",
+ "array[2][1] = 2 * 10 + 1\n",
+ "\n",
+ "# Result\n",
+ "print ('array[0]')\n",
+ "print (array[0][0])\n",
+ "print (array[0][1])\n",
+ "print ('\\n')\n",
+ "\n",
+ "print ('array[1]')\n",
+ "print (array[1][0])\n",
+ "print (array[1][1])\n",
+ "print ('\\n')\n",
+ "\n",
+ "print ('array[2]')\n",
+ "print (array[2][0])\n",
+ "print (array[2][1])\n",
+ "print ('\\n')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "array[0]\n",
+ "0\n",
+ "1\n",
+ "\n",
+ "\n",
+ "array[1]\n",
+ "10\n",
+ "11\n",
+ "\n",
+ "\n",
+ "array[2]\n",
+ "20\n",
+ "21\n",
+ "\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.8, Page number: 94"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "line = 4\n",
+ "\n",
+ "# Result\n",
+ "print ('Twice %d is %d' % (line, line * 2))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Twice 4 is 8\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.9, Page number: 95"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "width = 12\n",
+ "height = 10\n",
+ "\n",
+ "# Calculation\n",
+ "area = (width * height) / 2\n",
+ "\n",
+ "# Result\n",
+ "print ('The area is %d' % area)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The area is 60\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 5.10, Page number: 107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "width = 4\n",
+ "height = 6\n",
+ "\n",
+ "# Calculation\n",
+ "area = (width * height) / 2\n",
+ "\n",
+ "# Result\n",
+ "print ('The area is %d' % area)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The area is 12\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_6_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_6_4.ipynb
new file mode 100755
index 00000000..2769b901
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_6_4.ipynb
@@ -0,0 +1,224 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:72c49f1aed7f4d43ac1084e67245cfba7b011cb43f84b1ab3ef13b081aec557f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 6: Decision and control statements"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 6.1, Page number: 114"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "old_number = 1\n",
+ "current_number = 1\n",
+ "\n",
+ "print ('1')\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (current_number < 100) :\n",
+ " print (current_number)\n",
+ " next_number = current_number + old_number\n",
+ "\n",
+ " old_number = current_number\n",
+ " current_number = next_number"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "1\n",
+ "1\n",
+ "2\n",
+ "3\n",
+ "5\n",
+ "8\n",
+ "13\n",
+ "21\n",
+ "34\n",
+ "55\n",
+ "89\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 6.2, Page number: 115"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation\n",
+ "while (i < 10) :\n",
+ " item = 1\n",
+ "\n",
+ " if item == 0 :\n",
+ " break\n",
+ "\n",
+ " total += item\n",
+ " print ('Total: %d' % total)\n",
+ " i = i + 1\n",
+ " \n",
+ "# Result\n",
+ "print ('Final total: %d' % total)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total: 1\n",
+ "Total: 2\n",
+ "Total: 3\n",
+ "Total: 4\n",
+ "Total: 5\n",
+ "Total: 6\n",
+ "Total: 7\n",
+ "Total: 8\n",
+ "Total: 9\n",
+ "Total: 10\n",
+ "Final total: 10\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 6.3, Page number: 116"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "minus_items = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation\n",
+ "while (i < 10) :\n",
+ " item = 1\n",
+ " \n",
+ " if item == 0 :\n",
+ " break\n",
+ "\n",
+ " if item < 0 :\n",
+ " minus_items += 1\n",
+ " continue\n",
+ "\n",
+ " total += item\n",
+ " print ('Total: %d' % total)\n",
+ " i = i + 1\n",
+ " \n",
+ "# Result\n",
+ "print ('Final total: %d' % total)\n",
+ "print ('with %d negative items omitted' % minus_items)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Total: 1\n",
+ "Total: 2\n",
+ "Total: 3\n",
+ "Total: 4\n",
+ "Total: 5\n",
+ "Total: 6\n",
+ "Total: 7\n",
+ "Total: 8\n",
+ "Total: 9\n",
+ "Total: 10\n",
+ "Final total: 10\n",
+ "with 0 negative items omitted\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 6.4, Page number: 118"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "balance_owed = 100\n",
+ "\n",
+ "# Calculation and result\n",
+ "if balance_owed == 0 :\n",
+ " print ('You owe nothing.')\n",
+ "else :\n",
+ " print ('You owe %d dollars.' % balance_owed)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "You owe 100 dollars.\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_7_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_7_4.ipynb
new file mode 100755
index 00000000..620d440f
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_7_4.ipynb
@@ -0,0 +1,184 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2555ca3a1b68efa7cc762303e679c4f4dbb6d27bc5633d2ac8b64fe540cb2399"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 7: Programming process"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.1, Page number: 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "result = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (i < 3) :\n",
+ " print ('Result: %d' % result)\n",
+ " operator = '+'\n",
+ " value = 10\n",
+ "\n",
+ " if operator == '+' :\n",
+ " result += value\n",
+ " else :\n",
+ " print ('Unknown operator %c' % operator)\n",
+ " i = i + 1 "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Result: 0\n",
+ "Result: 10\n",
+ "Result: 20\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.2, Page number: 133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "result = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (i < 3) :\n",
+ " print ('Result: %d' % result)\n",
+ " operator = '+'\n",
+ " value = 5\n",
+ "\n",
+ " if operator == 'q' or operator == 'Q' :\n",
+ " break\n",
+ "\n",
+ " if operator == '+' :\n",
+ " result += value\n",
+ "\n",
+ " if operator == '-' :\n",
+ " result -= value\n",
+ "\n",
+ " if operator == '*' :\n",
+ " result *= value\n",
+ "\n",
+ " if operator == '/' :\n",
+ " if value == 0 :\n",
+ " print ('Error: Divide by zero')\n",
+ " print ('operation ignored') \n",
+ " else :\n",
+ " result /= value\n",
+ "\n",
+ " i = i + 1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Result: 0\n",
+ "Result: 5\n",
+ "Result: 10\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 7.3, Page number: 140"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "import sys\n",
+ "import random\n",
+ "while (1) :\n",
+ "\n",
+ " # random number to be guessed\n",
+ " number_to_guess = random.randrange (1, 101, 1)\n",
+ "\n",
+ " # current lower limit of player's range\n",
+ " low_limit = 0\n",
+ "\n",
+ " # current upper limit of player's range\n",
+ " high_limit = 100\n",
+ " \n",
+ " # number of times player guessed\n",
+ " guess_count = 0\n",
+ "\n",
+ " while (1) :\n",
+ " \n",
+ " # tell user what the bounds are and get his guess\n",
+ " print ('Bounds %d - %d\\n' % (low_limit, high_limit))\n",
+ " print ('Value[%d]?' % guess_count)\n",
+ " \n",
+ " guess_count += 1\n",
+ "\n",
+ " # number gotten from the player\n",
+ " player_number = 50\n",
+ "\n",
+ " # did he guess right?\n",
+ " if (player_number == number_to_guess) :\n",
+ " break\n",
+ "\n",
+ " # adjust bounds for next guess\n",
+ " if (player_number < number_to_guess) :\n",
+ " low_limit = player_number\n",
+ " \n",
+ " else :\n",
+ " high_limit = player_number\n",
+ "\n",
+ " print ('Bingo\\n')"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_8_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_8_4.ipynb
new file mode 100755
index 00000000..24580c55
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_8_4.ipynb
@@ -0,0 +1,349 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:10a432341f6033fcf678cc580d953b0c94ad7350aa1431ba3e0517904d3e90c8"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 8: More control statements"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.1, Page number: 144"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "counter = 0\n",
+ "\n",
+ "# Calculation\n",
+ "while (counter < 5) :\n",
+ " current = 3\n",
+ " total += current\n",
+ " counter += 1\n",
+ "\n",
+ "# Result\n",
+ "print ('The grand total is %d' % total)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The grand total is 15\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.2, Page number: 145"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "total = 0\n",
+ "\n",
+ "# Calculation\n",
+ "for counter in range (0, 5) :\n",
+ " current = 5\n",
+ " total += current\n",
+ "\n",
+ "# Result\n",
+ "print ('The grand total is %d' % total)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The grand total is 25\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.3, Page number: 146"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration, calculation and result\n",
+ "for celsius in range (0, 101) :\n",
+ " print ('Celsius: %d Fahrenheit: %d' % (celsius, (celsius * 9) / 5 +32))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Celsius: 0 Fahrenheit: 32\n",
+ "Celsius: 1 Fahrenheit: 33\n",
+ "Celsius: 2 Fahrenheit: 35\n",
+ "Celsius: 3 Fahrenheit: 37\n",
+ "Celsius: 4 Fahrenheit: 39\n",
+ "Celsius: 5 Fahrenheit: 41\n",
+ "Celsius: 6 Fahrenheit: 42\n",
+ "Celsius: 7 Fahrenheit: 44\n",
+ "Celsius: 8 Fahrenheit: 46\n",
+ "Celsius: 9 Fahrenheit: 48\n",
+ "Celsius: 10 Fahrenheit: 50\n",
+ "Celsius: 11 Fahrenheit: 51\n",
+ "Celsius: 12 Fahrenheit: 53\n",
+ "Celsius: 13 Fahrenheit: 55\n",
+ "Celsius: 14 Fahrenheit: 57\n",
+ "Celsius: 15 Fahrenheit: 59\n",
+ "Celsius: 16 Fahrenheit: 60\n",
+ "Celsius: 17 Fahrenheit: 62\n",
+ "Celsius: 18 Fahrenheit: 64\n",
+ "Celsius: 19 Fahrenheit: 66\n",
+ "Celsius: 20 Fahrenheit: 68\n",
+ "Celsius: 21 Fahrenheit: 69\n",
+ "Celsius: 22 Fahrenheit: 71\n",
+ "Celsius: 23 Fahrenheit: 73\n",
+ "Celsius: 24 Fahrenheit: 75\n",
+ "Celsius: 25 Fahrenheit: 77\n",
+ "Celsius: 26 Fahrenheit: 78\n",
+ "Celsius: 27 Fahrenheit: 80\n",
+ "Celsius: 28 Fahrenheit: 82\n",
+ "Celsius: 29 Fahrenheit: 84\n",
+ "Celsius: 30 Fahrenheit: 86\n",
+ "Celsius: 31 Fahrenheit: 87\n",
+ "Celsius: 32 Fahrenheit: 89\n",
+ "Celsius: 33 Fahrenheit: 91\n",
+ "Celsius: 34 Fahrenheit: 93\n",
+ "Celsius: 35 Fahrenheit: 95\n",
+ "Celsius: 36 Fahrenheit: 96\n",
+ "Celsius: 37 Fahrenheit: 98\n",
+ "Celsius: 38 Fahrenheit: 100\n",
+ "Celsius: 39 Fahrenheit: 102\n",
+ "Celsius: 40 Fahrenheit: 104\n",
+ "Celsius: 41 Fahrenheit: 105\n",
+ "Celsius: 42 Fahrenheit: 107\n",
+ "Celsius: 43 Fahrenheit: 109\n",
+ "Celsius: 44 Fahrenheit: 111\n",
+ "Celsius: 45 Fahrenheit: 113\n",
+ "Celsius: 46 Fahrenheit: 114\n",
+ "Celsius: 47 Fahrenheit: 116\n",
+ "Celsius: 48 Fahrenheit: 118\n",
+ "Celsius: 49 Fahrenheit: 120\n",
+ "Celsius: 50 Fahrenheit: 122\n",
+ "Celsius: 51 Fahrenheit: 123\n",
+ "Celsius: 52 Fahrenheit: 125\n",
+ "Celsius: 53 Fahrenheit: 127\n",
+ "Celsius: 54 Fahrenheit: 129\n",
+ "Celsius: 55 Fahrenheit: 131\n",
+ "Celsius: 56 Fahrenheit: 132\n",
+ "Celsius: 57 Fahrenheit: 134\n",
+ "Celsius: 58 Fahrenheit: 136\n",
+ "Celsius: 59 Fahrenheit: 138\n",
+ "Celsius: 60 Fahrenheit: 140\n",
+ "Celsius: 61 Fahrenheit: 141\n",
+ "Celsius: 62 Fahrenheit: 143\n",
+ "Celsius: 63 Fahrenheit: 145\n",
+ "Celsius: 64 Fahrenheit: 147\n",
+ "Celsius: 65 Fahrenheit: 149\n",
+ "Celsius: 66 Fahrenheit: 150\n",
+ "Celsius: 67 Fahrenheit: 152\n",
+ "Celsius: 68 Fahrenheit: 154\n",
+ "Celsius: 69 Fahrenheit: 156\n",
+ "Celsius: 70 Fahrenheit: 158\n",
+ "Celsius: 71 Fahrenheit: 159\n",
+ "Celsius: 72 Fahrenheit: 161\n",
+ "Celsius: 73 Fahrenheit: 163\n",
+ "Celsius: 74 Fahrenheit: 165\n",
+ "Celsius: 75 Fahrenheit: 167\n",
+ "Celsius: 76 Fahrenheit: 168\n",
+ "Celsius: 77 Fahrenheit: 170\n",
+ "Celsius: 78 Fahrenheit: 172\n",
+ "Celsius: 79 Fahrenheit: 174\n",
+ "Celsius: 80 Fahrenheit: 176\n",
+ "Celsius: 81 Fahrenheit: 177\n",
+ "Celsius: 82 Fahrenheit: 179\n",
+ "Celsius: 83 Fahrenheit: 181\n",
+ "Celsius: 84 Fahrenheit: 183\n",
+ "Celsius: 85 Fahrenheit: 185\n",
+ "Celsius: 86 Fahrenheit: 186\n",
+ "Celsius: 87 Fahrenheit: 188\n",
+ "Celsius: 88 Fahrenheit: 190\n",
+ "Celsius: 89 Fahrenheit: 192\n",
+ "Celsius: 90 Fahrenheit: 194\n",
+ "Celsius: 91 Fahrenheit: 195\n",
+ "Celsius: 92 Fahrenheit: 197\n",
+ "Celsius: 93 Fahrenheit: 199\n",
+ "Celsius: 94 Fahrenheit: 201\n",
+ "Celsius: 95 Fahrenheit: 203\n",
+ "Celsius: 96 Fahrenheit: 204\n",
+ "Celsius: 97 Fahrenheit: 206\n",
+ "Celsius: 98 Fahrenheit: 208\n",
+ "Celsius: 99 Fahrenheit: 210\n",
+ "Celsius: 100 Fahrenheit: 212\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.4, Page number: 147"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "# Variable declaration\n",
+ "seven_count = 0\n",
+ "three_count = 0\n",
+ "data = []\n",
+ "\n",
+ "# Calculation\n",
+ "for i in range (0, 5) :\n",
+ " x = 7\n",
+ " data.append(int(x))\n",
+ "print (data)\n",
+ "\n",
+ "for index in range (0, 5) :\n",
+ " if data[index] == 3 :\n",
+ " three_count += 1\n",
+ "\n",
+ " if data[index] == 7 :\n",
+ " seven_count += 1\n",
+ "\n",
+ "# Result\n",
+ "print ('Threes %d Sevens %d' % (three_count, seven_count))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "[7, 7, 7, 7, 7]\n",
+ "Threes 0 Sevens 5\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 8.6, Page number: 149"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "# Variable declaration\n",
+ "result = 0\n",
+ "i = 0\n",
+ "\n",
+ "# Calculation and result\n",
+ "while (i < 3) :\n",
+ " print ('Result: %d' % result)\n",
+ " operator = '-'\n",
+ " value = 10\n",
+ "\n",
+ " if operator == 'q' or operator == 'Q' :\n",
+ " break\n",
+ "\n",
+ " elif operator == '+' :\n",
+ " result += value\n",
+ "\n",
+ " elif operator == '-' :\n",
+ " result -= value\n",
+ "\n",
+ " elif operator == '*' :\n",
+ " result *= value\n",
+ "\n",
+ " elif operator == '/' :\n",
+ " if value == 0 :\n",
+ " print ('Error: Divide by zero')\n",
+ " print ('operation ignored') \n",
+ " else :\n",
+ " result /= value\n",
+ "\n",
+ " else :\n",
+ " print ('Unknown operator %c' % operator)\n",
+ " i = i + 1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Result: 0\n",
+ "Result: -10\n",
+ "Result: -20\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [],
+ "language": "python",
+ "metadata": {},
+ "outputs": []
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/Chapter_9_4.ipynb b/Practical_C_Programming_by_Steve_Oualline/Chapter_9_4.ipynb
new file mode 100755
index 00000000..39cb7cdd
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/Chapter_9_4.ipynb
@@ -0,0 +1,166 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9022b72f2fc24432e92fa44cdfeb3da1fa5525a0485bb76b898e97e55f78a4d8"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 9: Variable scope and functions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.1, Page number: 160"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def func() :\n",
+ " if not hasattr(func, \"permanent\") :\n",
+ " func.permanent = 1\n",
+ " result = func.permanent\n",
+ " func.permanent += 1\n",
+ " return result\n",
+ "\n",
+ "for counter in range (0, 3) :\n",
+ " temporary = 1\n",
+ " print ('Temporary %d Permanent %d' % (temporary, func()))\n",
+ " temporary += 1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Temporary 1 Permanent 1\n",
+ "Temporary 1 Permanent 2\n",
+ "Temporary 1 Permanent 3\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.3, Page number: 164"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def triangle (width, height) :\n",
+ " area = width * height / 2.0\n",
+ " return area\n",
+ "\n",
+ "print ('Triangle #1 %f' % (triangle (1.3, 8.3)))\n",
+ "print ('Triangle #2 %f' % (triangle (4.8, 9.8)))\n",
+ "print ('Triangle #3 %f' % (triangle (1.2, 2.0)))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Triangle #1 5.395000\n",
+ "Triangle #2 23.520000\n",
+ "Triangle #3 1.200000\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.4, Page number: 166"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "def length (string) :\n",
+ " return len(string)\n",
+ "\n",
+ "line = 'hello world' \n",
+ "\n",
+ "print ('Length is: %d' % length(line))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Length is: 11\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 3,
+ "metadata": {},
+ "source": [
+ "Example 9.6, Page number: 170"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "\n",
+ "\n",
+ "def length (string) :\n",
+ " return len(string)\n",
+ "\n",
+ "line = 'Steve Oualline'\n",
+ "\n",
+ "print ('Length is: %d' % length(line))"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Length is: 14\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/README.txt b/Practical_C_Programming_by_Steve_Oualline/README.txt
new file mode 100755
index 00000000..82e51f0a
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/README.txt
@@ -0,0 +1,10 @@
+Contributed By: Mahesh M
+Course: btech
+College/Institute/Organization: Maharaja Surajmal Institute of Technology, New Delhi
+Department/Designation: Computer Science engineering
+Book Title: Practical C Programming
+Author: Steve Oualline
+Publisher: O'Reilly Media
+Year of publication: 1997
+Isbn: 978-1565923065
+Edition: 3rd \ No newline at end of file
diff --git a/Practical_C_Programming_by_Steve_Oualline/numbers.dat b/Practical_C_Programming_by_Steve_Oualline/numbers.dat
new file mode 100755
index 00000000..573541ac
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/numbers.dat
@@ -0,0 +1 @@
+0
diff --git a/Practical_C_Programming_by_Steve_Oualline/numbers.dat~ b/Practical_C_Programming_by_Steve_Oualline/numbers.dat~
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/numbers.dat~
diff --git a/Practical_C_Programming_by_Steve_Oualline/screenshots/ancientcompilers.png b/Practical_C_Programming_by_Steve_Oualline/screenshots/ancientcompilers.png
new file mode 100755
index 00000000..46fba46d
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/screenshots/ancientcompilers.png
Binary files differ
diff --git a/Practical_C_Programming_by_Steve_Oualline/screenshots/bitoperations.png b/Practical_C_Programming_by_Steve_Oualline/screenshots/bitoperations.png
new file mode 100755
index 00000000..48925b6a
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/screenshots/bitoperations.png
Binary files differ
diff --git a/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-1.png b/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-1.png
new file mode 100755
index 00000000..bfa1980b
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-1.png
Binary files differ
diff --git a/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-2.png b/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-2.png
new file mode 100755
index 00000000..ddc5be59
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-2.png
Binary files differ
diff --git a/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-3.png b/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-3.png
new file mode 100755
index 00000000..7f65aa5c
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/screenshots/mahesh-3.png
Binary files differ
diff --git a/Practical_C_Programming_by_Steve_Oualline/screenshots/programmingprocess.png b/Practical_C_Programming_by_Steve_Oualline/screenshots/programmingprocess.png
new file mode 100755
index 00000000..c2f21380
--- /dev/null
+++ b/Practical_C_Programming_by_Steve_Oualline/screenshots/programmingprocess.png
Binary files differ