summaryrefslogtreecommitdiff
path: root/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb
diff options
context:
space:
mode:
authorhardythe12015-06-11 17:31:11 +0530
committerhardythe12015-06-11 17:31:11 +0530
commit79c59acc7af08ede23167b8455de4b716f77601f (patch)
tree2d6ff34b6f131d2671e4c6b798f210b3cb1d4ac7 /Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb
parentdf60071cf1d1c18822d34f943ab8f412a8946b69 (diff)
downloadPython-Textbook-Companions-79c59acc7af08ede23167b8455de4b716f77601f.tar.gz
Python-Textbook-Companions-79c59acc7af08ede23167b8455de4b716f77601f.tar.bz2
Python-Textbook-Companions-79c59acc7af08ede23167b8455de4b716f77601f.zip
add books
Diffstat (limited to 'Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb')
-rwxr-xr-xComputer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb125
1 files changed, 125 insertions, 0 deletions
diff --git a/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb b/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb
new file mode 100755
index 00000000..0c43b667
--- /dev/null
+++ b/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter13_14.ipynb
@@ -0,0 +1,125 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1ba129031b3dd7ed7efce1207bad751b6003f133c0f192eb72df391881da05bb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "13:STRUCTURE AND UNIONS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "13.2.1, page number:203"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from collections import namedtuple\n",
+ "MyStruct = namedtuple(\"MyStruct\", \"regno fees\")\n",
+ "\n",
+ "integer = MyStruct(\"1234\", \" \")\n",
+ "real = MyStruct(\" \",\"320.17\")\n",
+ "integer=integer._replace(fees=real.fees)\n",
+ "real=real._replace(regno=integer.regno)\n",
+ "\n",
+ "print \"Reg_no : \",real.regno,\",Reg.no : \",integer.fees"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reg_no : 1234 ,Reg.no : 320.17\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "13.3.1, page number:203"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from collections import namedtuple\n",
+ "MyStruct = namedtuple(\"MyStruct\", \"regno fees\")\n",
+ "\n",
+ "\n",
+ "student = MyStruct(\"1234\", \"320.17\")\n",
+ "\n",
+ "print \"Reg.no : \",student.regno,\",Reg.no : \",student.fees"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reg.no : 1234 ,Reg.no : 320.17\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "13.4.1, page number:204"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from collections import namedtuple\n",
+ "MyStruct = namedtuple(\"MyStruct\", \"regno fees\")\n",
+ "\n",
+ "integer = MyStruct(\"1234\", \"320.17\")\n",
+ "real = MyStruct(\"\",\"\")\n",
+ "real=real._replace(regno=integer.regno,fees=integer.fees)\n",
+ "\n",
+ "print \"Reg_no : \",real.regno,\",Reg.no : \",real.fees"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Reg_no : 1234 ,Reg.no : 320.17\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file