summaryrefslogtreecommitdiff
path: root/Practical_C_Programming/Chapter_21_1.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Practical_C_Programming/Chapter_21_1.ipynb')
-rw-r--r--Practical_C_Programming/Chapter_21_1.ipynb34
1 files changed, 29 insertions, 5 deletions
diff --git a/Practical_C_Programming/Chapter_21_1.ipynb b/Practical_C_Programming/Chapter_21_1.ipynb
index 8d3e6b65..144ac453 100644
--- a/Practical_C_Programming/Chapter_21_1.ipynb
+++ b/Practical_C_Programming/Chapter_21_1.ipynb
@@ -1,6 +1,7 @@
{
"metadata": {
- "name": "Chapter 21"
+ "name": "",
+ "signature": "sha256:519d4be291344b242a6ae999f129aea597642f5315e1fe947ec2b9d627dcc018"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -11,25 +12,48 @@
"cell_type": "heading",
"level": 1,
"metadata": {},
- "source": "Chapter 21: C's dustier corners"
+ "source": [
+ "Chapter 21: C's dustier corners"
+ ]
},
{
"cell_type": "heading",
"level": 3,
"metadata": {},
- "source": "Example 21.1, Page number: 401"
+ "source": [
+ "Example 21.1, Page number: 401"
+ ]
},
{
"cell_type": "code",
"collapsed": false,
- "input": "# Example 21.1.py\n# To check whether the character input by the user is for 'add', 'delete' or 'quit'\n\n\n# Variable declaration\nimport sys\nline = 'a'\n\n# Calculation and result\nif (line == 'a') :\n print ('Add\\n')\nelif (line == 'd') :\n print ('Delete\\n')\nelif (line == 'q') :\n print ('Quit\\n')\n sys.exit(1) \nelse :\n print ('Error:Bad command %c\\n' % line)",
+ "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"
+ "text": [
+ "Add\n",
+ "\n"
+ ]
}
],
"prompt_number": 1