summaryrefslogtreecommitdiff
path: root/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb')
-rw-r--r--Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb201
1 files changed, 166 insertions, 35 deletions
diff --git a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
index f6589ebe..6d38324f 100644
--- a/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
+++ b/Engineering_Thermodynamics:_A_Computer_Approach_(SI_Units_Version)/ch1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "ch1"
+ "name": "",
+ "signature": "sha256:2fa8b19d5030cf6dee0c92c2ee4889d5f3659cfd258460db8d8dc9ca2e443363"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -10,14 +11,20 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nExample 1.1\n\"\"\"\nprint \"Hello, World!\\n\"\n",
+ "input": [
+ "\n",
+ "print \"Hello, World!\\n\"\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n\n"
+ "text": [
+ "Hello, World!\n",
+ "\n"
+ ]
}
],
"prompt_number": 1
@@ -25,14 +32,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 1.2\nprints 'hello world' with comments.\n'''\n\n# prints \"Hello, World!\":\nprint \"Hello, World!\\n\"",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hello, World!\\n\""
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n\n"
+ "text": [
+ "Hello, World!\n",
+ "\n"
+ ]
}
],
"prompt_number": 2
@@ -40,14 +55,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nexample 1.3\nanother version of hello world.\n'''\n\n# prints \"Hello, World!\":\nprint \"Hel\" + \"lo, Wo\" + \"rld!\" \n\n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hel\" + \"lo, Wo\" + \"rld!\" \n",
+ "\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n"
+ "text": [
+ "Hello, World!\n"
+ ]
}
],
"prompt_number": 3
@@ -55,14 +78,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "\"\"\"\nexample 1.4\nanother version of hello world.\n\"\"\"\n\n# prints \"Hello, World!\":\nprint \"Hello, W\" + 'o' + \"rld\" + '!' ",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"Hello, World!\":\n",
+ "print \"Hello, W\" + 'o' + \"rld\" + '!' "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Hello, World!\n"
+ "text": [
+ "Hello, World!\n"
+ ]
}
],
"prompt_number": 4
@@ -70,14 +100,21 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.5 Inserting Numeric Literals into the Standard Output Stream\n'''\n\n# prints \"The Millennium ends Dec 31 2000.\":\nprint \"The Millennium ends Dec %d %d \" %(31,2000)",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"The Millennium ends Dec 31 2000.\":\n",
+ "print \"The Millennium ends Dec %d %d \" %(31,2000)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "The Millennium ends Dec 31 2000 \n"
+ "text": [
+ "The Millennium ends Dec 31 2000 \n"
+ ]
}
],
"prompt_number": 5
@@ -85,14 +122,24 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.6 Using Integer Variables\nIn this example, the integer 44 is assigned to the variable m, and the value of the expression m + 33\nis assigned to the variable n:\n'''\n# prints \"m = 44 and n = 77\":\n\nm = 44 # assigns the value 44 to the variable m\nprint \"m = %d \" % m,\nn = m + 33 # assigns the value 77 to the variable n\nprint \"and n = %d \" % n",
+ "input": [
+ "\n",
+ "# prints \"m = 44 and n = 77\":\n",
+ "\n",
+ "m = 44 # assigns the value 44 to the variable m\n",
+ "print \"m = %d \" % m,\n",
+ "n = m + 33 # assigns the value 77 to the variable n\n",
+ "print \"and n = %d \" % n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 44 and n = 77 \n"
+ "text": [
+ "m = 44 and n = 77 \n"
+ ]
}
],
"prompt_number": 6
@@ -100,14 +147,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.7 A Program's Tokens\n'''\n\n# prints \"n = 44:\nn=44\nprint \"n = %d\" % n",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"n = 44:\n",
+ "n=44\n",
+ "print \"n = %d\" % n"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
}
],
"prompt_number": 7
@@ -115,14 +170,22 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.8 \n'''\n\n# Python does not have semicolons so wont give any errors.\nn=44\nprint \"n = %d\" % n ",
+ "input": [
+ "\n",
+ "\n",
+ "# Python does not have semicolons so wont give any errors.\n",
+ "n=44\n",
+ "print \"n = %d\" % n "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "n = 44\n"
+ "text": [
+ "n = 44\n"
+ ]
}
],
"prompt_number": 8
@@ -130,14 +193,23 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.9 Initializing Variables\nThis program contains one variable that is not initialized and one that is initialized.\nNote : This program would give you differ output then c gives.\n'''\n\n# prints \"m = ?? and n = 44\":\nm = 0 #In python we do not have declaration of variables, we just initialize it and use it.\nn=44\nprint \"m = %d and n = %d\" %(m,n)",
+ "input": [
+ "\n",
+ "\n",
+ "# prints \"m = ?? and n = 44\":\n",
+ "m = 0 #In python we do not have declaration of variables, we just initialize it and use it.\n",
+ "n=44\n",
+ "print \"m = %d and n = %d\" %(m,n)"
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 0 and n = 44\n"
+ "text": [
+ "m = 0 and n = 44\n"
+ ]
}
],
"prompt_number": 9
@@ -145,7 +217,16 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.10 The const Specifier\nThis program illustrates constant definitions:\n'''\n\n# defines constants; has no output:\nBEEP = '\\b'\nMAXINT = 2147483647\nN = MAXINT/2\nKM_PER_MI = 1.60934\nPI = 3.14159265358979323846\n",
+ "input": [
+ "\n",
+ "\n",
+ "# defines constants; has no output:\n",
+ "BEEP = '\\b'\n",
+ "MAXINT = 2147483647\n",
+ "N = MAXINT/2\n",
+ "KM_PER_MI = 1.60934\n",
+ "PI = 3.14159265358979323846\n"
+ ],
"language": "python",
"metadata": {},
"outputs": [],
@@ -154,83 +235,133 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "'''\nEXAMPLE 1.11 Using the Input Operator\n'''\n\n# tests the input of integers, floats, and characters:\nprint \"Enter two integers: \"\nm = int(raw_input())\nn = int(raw_input())\nprint \"m = %d , n = %d \" %(m,n)\n\nprint \"Enter three decimal numbers: \"\nx = float(raw_input())\ny = float(raw_input())\nz = float(raw_input())\n\nprint \"x = %f , y = %f , z = %f\" %(x,y,z)\n\nprint \"Enter four characters: \";\nc1 = raw_input()\nc2 = raw_input()\nc3 = raw_input()\nc4 = raw_input()\nprint \"c1 = \" + c1 + \", c2 = \" + c2 + \", c3 = \" + c3 + \", c4 = \" + c4 ",
+ "input": [
+ "\n",
+ "\n",
+ "# tests the input of integers, floats, and characters:\n",
+ "print \"Enter two integers: \"\n",
+ "m = int(raw_input())\n",
+ "n = int(raw_input())\n",
+ "print \"m = %d , n = %d \" %(m,n)\n",
+ "\n",
+ "print \"Enter three decimal numbers: \"\n",
+ "x = float(raw_input())\n",
+ "y = float(raw_input())\n",
+ "z = float(raw_input())\n",
+ "\n",
+ "print \"x = %f , y = %f , z = %f\" %(x,y,z)\n",
+ "\n",
+ "print \"Enter four characters: \";\n",
+ "c1 = raw_input()\n",
+ "c2 = raw_input()\n",
+ "c3 = raw_input()\n",
+ "c4 = raw_input()\n",
+ "print \"c1 = \" + c1 + \", c2 = \" + c2 + \", c3 = \" + c3 + \", c4 = \" + c4 "
+ ],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
- "text": "Enter two integers: \n"
+ "text": [
+ "Enter two integers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "22\n"
+ "text": [
+ "22\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "44\n"
+ "text": [
+ "44\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "m = 22 , n = 44 \nEnter three decimal numbers: \n"
+ "text": [
+ "m = 22 , n = 44 \n",
+ "Enter three decimal numbers: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "2.2\n"
+ "text": [
+ "2.2\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "4.4\n"
+ "text": [
+ "4.4\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "6.6\n"
+ "text": [
+ "6.6\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "x = 2.200000 , y = 4.400000 , z = 6.600000\nEnter four characters: \n"
+ "text": [
+ "x = 2.200000 , y = 4.400000 , z = 6.600000\n",
+ "Enter four characters: \n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "A\n"
+ "text": [
+ "A\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "B\n"
+ "text": [
+ "B\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "C\n"
+ "text": [
+ "C\n"
+ ]
},
{
"name": "stdout",
"output_type": "stream",
"stream": "stdout",
- "text": "D\n"
+ "text": [
+ "D\n"
+ ]
},
{
"output_type": "stream",
"stream": "stdout",
- "text": "c1 = A, c2 = B, c3 = C, c4 = D\n"
+ "text": [
+ "c1 = A, c2 = B, c3 = C, c4 = D\n"
+ ]
}
],
"prompt_number": 11
@@ -238,7 +369,7 @@
{
"cell_type": "code",
"collapsed": false,
- "input": "",
+ "input": [],
"language": "python",
"metadata": {},
"outputs": []