diff options
author | debashisdeb | 2014-06-20 15:42:42 +0530 |
---|---|---|
committer | debashisdeb | 2014-06-20 15:42:42 +0530 |
commit | 83c1bfceb1b681b4bb7253b47491be2d8b2014a1 (patch) | |
tree | f54eab21dd3d725d64a495fcd47c00d37abed004 /Beginning_C_By_Ivon_Horton | |
parent | a78126bbe4443e9526a64df9d8245c4af8843044 (diff) | |
download | Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.tar.gz Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.tar.bz2 Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.zip |
removing problem statements
Diffstat (limited to 'Beginning_C_By_Ivon_Horton')
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter1.ipynb | 33 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter10.ipynb | 47 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter11.ipynb | 40 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter12.ipynb | 33 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter13.ipynb | 18 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter14.ipynb | 23 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter2.ipynb | 67 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter3.ipynb | 49 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter4.ipynb | 58 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter5.ipynb | 35 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter6.ipynb | 44 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter7.ipynb | 65 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter8.ipynb | 23 | ||||
-rw-r--r-- | Beginning_C_By_Ivon_Horton/chapter9.ipynb | 41 |
14 files changed, 149 insertions, 427 deletions
diff --git a/Beginning_C_By_Ivon_Horton/chapter1.ipynb b/Beginning_C_By_Ivon_Horton/chapter1.ipynb index c989b607..a59448aa 100644 --- a/Beginning_C_By_Ivon_Horton/chapter1.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter1.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:8e3cf2addd66f79ee38d4e50bfee328191c27b60f9cde7a75aa445057c2c6240" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,8 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Very First C Program - Displaying Hello World */\n", - "\"\"\"\n", + "\n", + "\n", "\n", "print \"Hello world!\"\n" ], @@ -58,9 +58,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Second C Program\n", - "\"\"\"\n", + "\n", "\n", "print \"\\\"If at first you don't succeed, try, try, try again!\\\"\"" ], @@ -89,9 +87,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Another Simple C Program - Displaying a Quotation\n", - "\"\"\"\n", + "\n", "\n", "print \"Beware the Ides of March!\"" ], @@ -120,9 +116,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Displaying Quotation \n", - "\"\"\"\n", + "\n", "\n", "print \"My formula for success?\\nRise early, work late, strike oil.\\n\"" ], @@ -153,9 +147,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Another Simple C Program - Displaying Great Quotations\n", - "\"\"\"\n", + "\n", "\n", "print \"\\\"It is a wise father that knows his own child.\\\"\\nShakespeare\\n\"" ], @@ -186,10 +178,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Another Simple C Program - Displaying Great Quotations\n", - "note: \\a does not work in python\n", - "\"\"\"\n", + "\n", "\n", "print \"Be careful!!\\n \\a\"" ], @@ -219,9 +208,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A longer program\n", - "\"\"\"\n", + "\n", "\n", "print \"Hi there!\\nThis program is a bit longer than the others.\"\n", "print \"But really it's only more text.\\n\\a\\a\"\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter10.ipynb b/Beginning_C_By_Ivon_Horton/chapter10.ipynb index fd052668..89cc83ed 100644 --- a/Beginning_C_By_Ivon_Horton/chapter10.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter10.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:67a316ecc3def0c634c382410d442033098ecf91839327bce17c0f2bf4424e27" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Exercising formatted input\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -234,9 +233,6 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Characters in the format control string\n", - "\"\"\"\n", "\n", "\n", "value_count = 2\n", @@ -309,11 +305,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Floating-Point Input\n", - "note: the way it is given in textbook is not possible in python. Just showing a\n", - "sample float input.\n", - "\"\"\"\n", + "\n", "\n", "value_count = 3\n", "print \"Enter: 3.14 3.14 3.14\"\n", @@ -387,9 +379,6 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Reading hexadecimal and octal values\n", - "\"\"\"\n", "\n", "print \"Enter three integer values: \"\n", "n = 3\n", @@ -459,9 +448,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Reading characters with scanf_s()\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter your first initial: \",\n", "initial = raw_input()\n", @@ -547,9 +534,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Reading a string with gets_s()\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter your first initial: \",\n", "initial = raw_input()\n", @@ -616,9 +601,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Reading and unreading characters\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter a sequence of integers and alphabetic names in a single line(separated by spaces): \",\n", "text = raw_input()\n", @@ -677,9 +660,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Ineger output variations\n", - "\"\"\"\n", + "\n", "\n", "i = 15\n", "j = 345\n", @@ -721,9 +702,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Variations on a single integer\n", - "\"\"\"\n", + "\n", "\n", "k = \"678\"\n", "hex_k = int(k, 16)\n", @@ -762,9 +741,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Outputting floating-point values\n", - "\"\"\"\n", + "\n", "\n", "fp1 = 345.678\n", "fp2 = 1.234E6\n", @@ -803,9 +780,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "print printable characters\n", - "\"\"\"\n", + "\n", "\n", "import string\n", "\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter11.ipynb b/Beginning_C_By_Ivon_Horton/chapter11.ipynb index b85dcda1..8bed3984 100644 --- a/Beginning_C_By_Ivon_Horton/chapter11.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter11.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:f5ae274b34f8832ebb766131ce16691aa9f05236c3dacd19d82ce9c6b22fe7d8" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Exercising the horse\n", - "\"\"\"\n", + "\n", "\n", "class Horse:\n", " age = 0\n", @@ -157,9 +156,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Exercising the horses\n", - "\"\"\"\n", + "\n", "\n", "class Horse:\n", " age = 0\n", @@ -416,9 +413,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Pointing out the horses\n", - "\"\"\"\n", + "\n", "\n", "class Horse:\n", " age = 0\n", @@ -586,9 +581,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Daisy chaining the horses\n", - "\"\"\"\n", + "\n", "\n", "class Horse:\n", " age = 0\n", @@ -764,9 +757,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Daisy chaining the horses both ways\n", - "\"\"\"\n", + "\n", "\n", "first = None\n", "current = None\n", @@ -1034,11 +1025,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 11.6, page no. 456\n", "\n", - "\"\"\"\n", - "Basics of a family tree\n", - "\"\"\"\n", "\n", "class Date:\n", " day = 0\n", @@ -1320,11 +1307,8 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 11.7, page no. 466\n", "\n", - "\"\"\"\n", - "binary tree to sort integers\n", - "\"\"\"\n", + "\n", "class Node:\n", " item = 0.0\n", " count = 0\n", @@ -1622,9 +1606,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "The operation of a union\n", - "\"\"\"\n", + "\n", "\n", "def print_date(date):\n", " if date.format == 0:\n", @@ -1709,11 +1691,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 11.9, page no. 482\n", "\n", - "\"\"\"\n", - "Generating a Bar chart\n", - "\"\"\"\n", "\n", "import numpy\n", "import sys\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter12.ipynb b/Beginning_C_By_Ivon_Horton/chapter12.ipynb index 71ea1f1a..b80c0151 100644 --- a/Beginning_C_By_Ivon_Horton/chapter12.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter12.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:792ce9bacf230895f9bb69020ed0a90ab017f7ded1cf3c8298370c217c100f66" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Writing a file a character at a time\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -104,9 +103,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "As the saying goes. . .it comes back!\n", - "\"\"\"\n", + "\n", "\n", "proverbs = [\"Many a mickle makes a muckle.\\n\",\n", " \"Too many cooks spoil the broth.\\n\",\n", @@ -198,9 +195,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Messing about with formatted file I/O\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -278,11 +273,9 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 12.4, page no. 514\n", "\n", - "\"\"\"\n", - "A prime example using binary files\n", - "\"\"\"\n", + "\n", + "\n", "\n", "import math\n", "import sys\n", @@ -412,11 +405,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 12.5, page no. 523\n", "\n", - "\"\"\"\n", - "Investigating the family.\n", - "\"\"\"\n", "\n", "class Date:\n", " day = 0\n", @@ -512,11 +501,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 12.6, page no. 531\n", "\n", - "\"\"\"\n", - "Writing a binary file with an update mode\n", - "\"\"\"\n", "\n", "MAXLEN = 50\n", "\n", @@ -564,11 +549,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "# Program 12.7, page no. 545\n", "\n", - "\"\"\"\n", - "Writing, reading and updating a binary file\n", - "\"\"\"\n", "\n", "class Record:\n", " name = \"\"\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter13.ipynb b/Beginning_C_By_Ivon_Horton/chapter13.ipynb index 8a2ffbe5..6169215b 100644 --- a/Beginning_C_By_Ivon_Horton/chapter13.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter13.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:a9141c3e95bf9510ebd3627775c232beb902109a956e0bd2f7e906b08fe40884" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Demonstrating assertions\n", - "\"\"\"\n", + "\n", "\n", "y = 5\n", "for x in range(20):\n", @@ -76,9 +75,6 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Test our timer function\n", - "\"\"\"\n", "\n", "import time\n", "import datetime\n", @@ -175,9 +171,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Getting date data with ease\n", - "\"\"\"\n", + "\n", "\n", "from datetime import *\n", "import time\n", @@ -228,9 +222,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Getting the day for a given date\n", - "\"\"\"\n", + "\n", "\n", "from datetime import *\n", "import time\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter14.ipynb b/Beginning_C_By_Ivon_Horton/chapter14.ipynb index 42a4f7a7..c351c6f1 100644 --- a/Beginning_C_By_Ivon_Horton/chapter14.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter14.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:275b458b34ae91067224e50705db107812d45fc58e5291ede57a7d2fe00a2167" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Classifying wide characters\n", - "\"\"\"\n", + "\n", "\n", "import string\n", "import sys\n", @@ -89,9 +88,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Finding occurrences of one wide character string in another\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter a string of less than 100 characters: \",\n", "text = raw_input()\n", @@ -170,9 +167,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Working with complex numbers\n", - "\"\"\"\n", + "\n", "\n", "cx = 1.0 + 3.0j\n", "cy = 1.0 - 4.0j\n", @@ -224,9 +219,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Joining threads\n", - "\"\"\"\n", + "\n", "\n", "from threading import Thread\n", "\n", @@ -283,9 +276,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Thread operations\n", - "\"\"\"\n", + "\n", "\n", "from threading import Thread\n", "import math\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter2.ipynb b/Beginning_C_By_Ivon_Horton/chapter2.ipynb index 7e4b1bf3..c8739188 100644 --- a/Beginning_C_By_Ivon_Horton/chapter2.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter2.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:62d8fc451396635cdeab5f4f92b23401a31f7b72236a9f3ecb8a6d1a87f20612" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "What is a Variable?\n", - "\"\"\"\n", + "\n", "\n", "print \"My salary is $10000\"" ], @@ -58,9 +57,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using a variable\n", - "\"\"\"\n", + "\n", " \n", "salary = 10000; #Declare and store 10000 in variable called salary\n", "print \"My salary is %d.\" %salary" @@ -90,9 +87,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using more variables\n", - "\"\"\"\n", + "\n", "\n", "brothers = 7 #declaring variable & storing value\n", "brides = 7 #declaring variable & storing value\n", @@ -124,9 +119,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Program 2.4 Simple calculations\n", - "\"\"\"\n", + "\n", "\n", "cats = 2\n", "dogs = 1\n", @@ -163,9 +156,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Calculations with cookies\n", - "\"\"\"\n", + "\n", "\n", "cookies = 5\n", "cookie_calories = 125\n", @@ -210,9 +201,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Cookies and kids\n", - "\"\"\"\n", + "\n", "\n", "cookies = 45\n", "children = 7\n", @@ -254,9 +243,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Division with float values\n", - "\"\"\"\n", + "\n", "\n", "plank_length = 10.0\n", "piece_count = 4.0\n", @@ -291,9 +278,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "calculations on a table\n", - "\"\"\"\n", + "\n", "\n", "radius = 0.0\n", "diameter = 0.0\n", @@ -354,9 +339,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "More round tables\n", - "\"\"\"\n", + "\n", "\n", "PI = 3.14159\n", " \n", @@ -419,9 +402,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Round tables again but shorter\n", - "\"\"\"\n", + "\n", "\n", "diameter = 0.0\n", "radius = 0.0\n", @@ -478,12 +459,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Data Types\n", - "Note: there is no long double, or float double or double range or short.\n", - "Also, the size of data types my defer compared to c & there is no limit so we\n", - "have skipped example 2.11 of this chapter\n", - "\"\"\"\n", + "\n", "\n", "import sys \n", "\n", @@ -520,10 +496,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Choosing the correct type for the job\n", - "note: there won't be any error as said in the book, hence, skipping 2.14\n", - "\"\"\"\n", + "\n", "\n", "Revenue_Per_150 = 4.5\n", "JanSold = 23500\n", @@ -572,9 +545,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Characters and numbers\n", - "\"\"\"\n", + "\n", "\n", "first = 'T'\n", "second = 63\n", @@ -613,9 +584,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using type char\n", - "\"\"\"\n", + "\n", "\n", "first = 'A'\n", "second = 'B'\n", @@ -658,9 +627,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Calculating the height of a tree\n", - "\"\"\"\n", + "\n", "\n", "shorty = 0.0\n", "lofty = 0.0\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter3.ipynb b/Beginning_C_By_Ivon_Horton/chapter3.ipynb index 49245eb1..74bd1aaf 100644 --- a/Beginning_C_By_Ivon_Horton/chapter3.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter3.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:395f91f52f5165130592aef7f92afdbea52f690b93426a4caf3da2a8b3404bd6" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A simple example of the if statement\n", - "\"\"\"\n", + "\n", "\n", "number = 0;\n", "print \"\\nEnter an integer between 1 and 10: \",\n", @@ -82,9 +81,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using if statements to decide on a discount\n", - "\"\"\"\n", + "\n", "\n", "unit_price = 3.50\n", "print \"Enter the number that you want to buy: \", \n", @@ -137,10 +134,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using nested ifs to analyze numbers\n", - "note: no need of LONG_MAX as there is no limit in python for an integer value\n", - "\"\"\"\n", + "\n", "\n", "test = 0.0\n", "print \"Enter an integer: \",\n", @@ -196,9 +190,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Converting uppercase to lowercase\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter an uppercase letter:\",\n", "letter = raw_input()\n", @@ -249,9 +241,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Testing letters an easier way\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter an uppercase letter:\",\n", "letter = raw_input()\n", @@ -301,9 +291,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Multiple Discount Levels\n", - "\"\"\"\n", + "\n", "\n", "unit_price = 3.50\n", "discount1 = 0.05\n", @@ -365,9 +353,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A confused recruiting policy \n", - "\"\"\"\n", + "\n", "\n", "age = 0\n", "college = 0\n", @@ -465,10 +451,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Lucky Lotteries\n", - "note: there is no switch statement in Python\n", - "\"\"\"\n", + "\n", "\n", "print \"Pick a number between 1 and 10 and you may win a prize! \",\n", "choice = int(raw_input())\n", @@ -527,9 +510,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Testing cases\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter Y or N: \",\n", "answer = raw_input()\n", @@ -581,9 +562,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Excercising bitwise operator\n", - "\"\"\"\n", + "\n", "\n", "original = 0xABC\n", "result = 0\n", @@ -627,9 +606,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A calculator\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter the calculation\\n\",\n", "number1 = float(raw_input(\"Enter first number: \"))\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter4.ipynb b/Beginning_C_By_Ivon_Horton/chapter4.ipynb index 1dd29164..72f009be 100644 --- a/Beginning_C_By_Ivon_Horton/chapter4.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter4.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:4c41735fb67bb40797fc8ec99d1c0b5c81a6828d699e86fe05c05b6962ed94db" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "List ten integers\n", - "\"\"\"\n", + "\n", "\n", "for count in range (1, 11):\n", " print count,\n", @@ -61,9 +60,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Drawing a box\n", - "\"\"\"\n", + "\n", "\n", "print \"**************\"\n", "for count in range(1, 9):\n", @@ -104,9 +101,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Sum the integers from 1 to a user-specified number\n", - "\"\"\"\n", + "\n", "\n", "sum = 0\n", "\n", @@ -158,11 +153,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Sum the integers from 1 to a user-specified number (compact version)\n", - "note: the way specified in book is not possible in Python, it will be same as\n", - "previous progam\n", - "\"\"\"\n", + "\n", "\n", "sum = 0\n", "\n", @@ -214,9 +205,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "summing the integers backward\n", - "\"\"\"\n", + "\n", "\n", "sum = 0\n", "\n", @@ -266,10 +255,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "The almost indefinite loop - computing an average\n", - "note: there cannot be infinit for loop in python, we will use while loop\n", - "\"\"\"\n", + "\n", "\n", "print \"This program calculates the average of any number of values.\"\n", "total = 0\n", @@ -406,9 +392,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A Guessing Game\n", - "\"\"\"\n", + "\n", "import sys\n", "\n", "chosen = 15\n", @@ -515,9 +499,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A More Interesting Guessing Game\n", - "\"\"\"\n", + "\n", "\n", "from random import *\n", "\n", @@ -624,9 +606,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "While programming and summing integers\n", - "\"\"\"\n", + "\n", "\n", "sum = 0\n", "i = 1\n", @@ -680,9 +660,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Output a box with given width and height\n", - "\"\"\"\n", + "\n", "\n", "MIN_SIZE = 3;\n", " \n", @@ -768,9 +746,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Sums of successive integer sequences\n", - "\"\"\"\n", + "\n", "\n", "sum = 0\n", "count = 0\n", @@ -836,9 +812,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Sums of integers with a while loop nested in a for loop\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter the number of integers you want to sum: \",\n", "count = int(raw_input())\n", @@ -905,9 +879,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Reversing the digits\n", - "\"\"\"\n", + "\n", "rebmun = 0\n", "print \"\\nEnter a positive integer: \",\n", "number = int(raw_input())\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter5.ipynb b/Beginning_C_By_Ivon_Horton/chapter5.ipynb index 3b34352d..8e195f37 100644 --- a/Beginning_C_By_Ivon_Horton/chapter5.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter5.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:a29cdeb847e548d8c74cdb11f8f6f17380a9a763c13e45e4e17605b4ec6cf4a6" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Averaging ten grades without storing them\n", - "\"\"\"\n", + "\n", "\n", "count = 10\n", "sum = 0\n", @@ -217,9 +216,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Averaging ten grades - storing values the hard way\n", - "\"\"\"\n", + "\n", "\n", "sum = 0\n", "average = 0.0\n", @@ -361,9 +358,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Averaging ten grades - storing the values the easy way\n", - "\"\"\"\n", + "\n", "\n", "grades = []\n", "count = 10\n", @@ -394,9 +389,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Reusing the numbers stored\n", - "\"\"\"\n", + "\n", "\n", "grades = []\n", "count = 10\n", @@ -599,9 +592,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using the & operator\n", - "\"\"\"\n", + "\n", "import sys\n", "\n", "a = 1\n", @@ -652,9 +643,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Know your hat size - if you dare...\n", - "\"\"\"\n", + "\n", "\n", "size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n", " ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n", @@ -720,9 +709,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Averaging a variable number of grades\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter the number of grades: \",\n", "nGrades = int(raw_input())\n", @@ -864,9 +851,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Tic-Tac-Toe\n", - "\"\"\"\n", + "\n", "\n", "player = 0\n", "winner = 0\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter6.ipynb b/Beginning_C_By_Ivon_Horton/chapter6.ipynb index fdf576c5..c05d45c7 100644 --- a/Beginning_C_By_Ivon_Horton/chapter6.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter6.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:cc6cd32b3760ef9f8d727f2cbad62d4127abffa00d3c9ad693debfc7914ad190" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Displaying a string\n", - "\"\"\"\n", + "\n", "\n", "print \"The character \\\\0 is used to terminate a string.\"" ], @@ -58,9 +57,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Lengths\n", - "\"\"\"\n", + "\n", "\n", "str1 = \"To be or not to be\"\n", "str2 = \",that is a question\"\n", @@ -94,9 +91,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Arrays of strings\n", - "\"\"\"\n", + "\n", "\n", "str1 = \"Computers do what you tell them to do, not what you want them to do.\"\n", "str2 = \"When you put something in memory, remember where you put it.\"\n", @@ -147,9 +142,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Joining strings\n", - "\"\"\"\n", + "\n", "\n", "preamble = \"The joke is: \"\n", "str1 = \"My dog hasn\\'t got any nose.\\n\"\n", @@ -189,9 +182,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Comparing strings\n", - "\"\"\"\n", + "\n", "\n", "print \"Type in the first word (maximum 20 characters): \",\n", "word1 = raw_input()\n", @@ -219,9 +210,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A demonstration of seeking and finding\n", - "\"\"\"\n", + "\n", "\n", "str1 = \"This string contains the holy grail.\"\n", "str2 = \"the holy grail\"\n", @@ -265,10 +254,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Find all the words\n", - "note: program 7A in the book will remain same in Python\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter some prose that is less than 1000 characters (go on typing hit enter to terminate):\"\n", "str1 = raw_input()\n", @@ -344,9 +330,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Testing characters in a string\n", - "\"\"\"\n", + "\n", "\n", "\n", "nLetters = 0\n", @@ -407,9 +391,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Finding occurrences of one string in another\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter the string to be searched (less than 100 characters): \",\n", "text = raw_input()\n", @@ -481,9 +463,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Analyzing Text\n", - "\"\"\"\n", + "\n", "\n", "import numpy\n", "\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter7.ipynb b/Beginning_C_By_Ivon_Horton/chapter7.ipynb index 7a7e0247..e46960ce 100644 --- a/Beginning_C_By_Ivon_Horton/chapter7.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter7.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:711ef8d09307cb9b16d63b16134924968e61ecb1c05fd7745b7d89ba9bc4ac32" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,10 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A simple program using pointers\n", - "note: there are no pointers in Python.\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -74,9 +72,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "What's the pointer of it all\n", - "\"\"\"\n", + "\n", "\n", "num1 = 0\n", "num2 = 0\n", @@ -115,10 +111,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using pointer arguments to scanf_s\n", - "note: in Python you cannot use pointers to input a value\n", - "\"\"\"\n", + "\n", "\n", "print \"Input an integer: \",\n", "value = int(raw_input())\n", @@ -164,9 +157,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Arrays and pointers\n", - "\"\"\"\n", + "\n", "\n", "multiple = ['M', 'y','s','t', 'r', 'i', 'n', 'g']\n", " \n", @@ -201,9 +192,6 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Incrementing a pointer to an array\n", - "\"\"\"\n", "\n", "multiple = \"a string\"\n", "p = multiple\n", @@ -243,9 +231,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Incrementing a pointer to an array of integers\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -286,9 +272,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Two-dimensional arrays and pointers\n", - "\"\"\"\n", + "\n", "\n", "board = [['1','2','3'],\n", " ['4','5','6'],\n", @@ -324,9 +308,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Two-dimensional arrays and pointers\n", - "\"\"\"\n", + "\n", "\n", "board = [['1','2','3'],\n", " ['4','5','6'],\n", @@ -363,9 +345,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Getting values in a two-dimensional array\n", - "\"\"\"\n", + "\n", "\n", "board = [['1','2','3'],\n", " ['4','5','6'],\n", @@ -408,9 +388,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Multidimensional arrays and pointers\n", - "\"\"\"\n", + "\n", "\n", "board = [['1','2','3'],\n", " ['4','5','6'],\n", @@ -453,9 +431,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Understand pointers to your hat size - if you dare\n", - "\"\"\"\n", + "\n", "\n", "size = [['6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'],\n", " ['1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'],\n", @@ -521,10 +497,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A dynamic prime example\n", - "note: program 7.12 will remain same\n", - "\"\"\"\n", + "\n", "\n", "pPrimes = []\n", "found = False\n", @@ -600,9 +573,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Extending dynamically allocated memory for strings\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -681,9 +652,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Using array notation with pointers to sort strings\n", - "\"\"\"\n", + "\n", "\n", "print \"Enter strings to be sorted, separated by '.' Press Enter to end: \"\n", "text = raw_input()\n", @@ -741,9 +710,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "An improved calculator\n", - "\"\"\"\n", + "\n", "\n", "print \"To use this calculator, enter any expression with or without spaces.\"\n", "print \"An expression may include the operators\"\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter8.ipynb b/Beginning_C_By_Ivon_Horton/chapter8.ipynb index 548884d6..2b0cdc0b 100644 --- a/Beginning_C_By_Ivon_Horton/chapter8.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter8.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:3fbbd33189f83aa6d0187f308c759f69619a009cb3b8fae3f4a0ad98df7c2c47" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Scoping out scope\n", - "\"\"\"\n", + "\n", "\n", "count1 = 1\n", "\n", @@ -116,9 +115,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Calculating an average using functions\n", - "\"\"\"\n", + "\n", "\n", "def Sum(x, n):\n", " sum = 0.0\n", @@ -224,9 +221,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "The functional approach to string sorting\n", - "\"\"\"\n", + "\n", "\n", "def sort_string(text):\n", " dot_separated = text.split('.')\n", @@ -284,9 +279,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A function to increase your pay\n", - "\"\"\"\n", + "\n", "\n", "def IncomePlus(pPay):\n", " pPay += 10000\n", @@ -324,9 +317,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A function to increase your pay that doesn't\n", - "\"\"\"\n", + "\n", "\n", "def IncomePlus(pPay):\n", " pPay += 10000\n", diff --git a/Beginning_C_By_Ivon_Horton/chapter9.ipynb b/Beginning_C_By_Ivon_Horton/chapter9.ipynb index d7adce09..6b5e2864 100644 --- a/Beginning_C_By_Ivon_Horton/chapter9.ipynb +++ b/Beginning_C_By_Ivon_Horton/chapter9.ipynb @@ -1,6 +1,7 @@ { "metadata": { - "name": "" + "name": "", + "signature": "sha256:6ada72776bf91dd75540d29fecfeda6a5cab8bde3c866cd455973111367e4933" }, "nbformat": 3, "nbformat_minor": 0, @@ -27,9 +28,6 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Pointing to functions\n", - "\"\"\"\n", "\n", "def sum(x, y):\n", " return x + y\n", @@ -79,9 +77,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Arrays of Pointers to functions\n", - "\"\"\"\n", + "\n", "\n", "def sum(x, y):\n", " return x + y\n", @@ -135,9 +131,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Passing a Pointer to a function\n", - "\"\"\"\n", + "\n", "\n", "def sum(x, y):\n", " return x + y\n", @@ -187,10 +181,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Static versus automatic variables\n", - "note: there is no static in python. Output will be different from book.\n", - "\"\"\"\n", + "\n", "\n", "def test1():\n", " count = 0\n", @@ -240,10 +231,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Global variables\n", - "note: output will vary from textbook because of static variable\n", - "\"\"\"\n", + "\n", "\n", "count = 0\n", "\n", @@ -295,9 +283,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Calculating factorials using recursion\n", - "\"\"\"\n", + "\n", "\n", "def factorial(n):\n", " if(n < 2):\n", @@ -348,10 +334,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "Calculating an average using variable argument lists\n", - "note: output will vary from that given in textbook\n", - "\"\"\"\n", + "\n", "\n", "def average(*arg):\n", " sum = arg[0] + arg[1]\n", @@ -399,9 +382,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "A program to list the command line arguments\n", - "\"\"\"\n", + "\n", "\n", "import sys\n", "\n", @@ -440,9 +421,7 @@ "cell_type": "code", "collapsed": false, "input": [ - "\"\"\"\n", - "REVERSI An Othello type game\n", - "\"\"\"\n", + "\n", "\n", "SIZE = 6\n", "comp_c = '@'\n", |