summaryrefslogtreecommitdiff
path: root/Beginning_C_By_Ivon_Horton/chapter2.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Beginning_C_By_Ivon_Horton/chapter2.ipynb')
-rw-r--r--Beginning_C_By_Ivon_Horton/chapter2.ipynb67
1 files changed, 17 insertions, 50 deletions
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",