From fba055ce5aa0955e22bac2413c33493b10ae6532 Mon Sep 17 00:00:00 2001 From: hardythe1 Date: Tue, 5 May 2015 14:21:39 +0530 Subject: add books --- .../chapter10.ipynb | 600 +++++++++++++++++++++ .../chapter11.ipynb | 373 +++++++++++++ .../chapter12.ipynb | 417 ++++++++++++++ .../chapter13.ipynb | 125 +++++ .../chapter15.ipynb | 384 +++++++++++++ Computer_Concepts_and_C_Programming/chapter5.ipynb | 50 ++ Computer_Concepts_and_C_Programming/chapter6.ipynb | 161 ++++++ Computer_Concepts_and_C_Programming/chapter7.ipynb | 85 +++ Computer_Concepts_and_C_Programming/chapter8.ipynb | 139 +++++ Computer_Concepts_and_C_Programming/chapter9.ipynb | 593 ++++++++++++++++++++ .../screenshots/chapter10.png | Bin 0 -> 47748 bytes .../screenshots/chapter12.png | Bin 0 -> 49415 bytes .../screenshots/chapter9.png | Bin 0 -> 43372 bytes 13 files changed, 2927 insertions(+) create mode 100755 Computer_Concepts_and_C_Programming/chapter10.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter11.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter12.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter13.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter15.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter5.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter6.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter7.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter8.ipynb create mode 100755 Computer_Concepts_and_C_Programming/chapter9.ipynb create mode 100755 Computer_Concepts_and_C_Programming/screenshots/chapter10.png create mode 100755 Computer_Concepts_and_C_Programming/screenshots/chapter12.png create mode 100755 Computer_Concepts_and_C_Programming/screenshots/chapter9.png (limited to 'Computer_Concepts_and_C_Programming') diff --git a/Computer_Concepts_and_C_Programming/chapter10.ipynb b/Computer_Concepts_and_C_Programming/chapter10.ipynb new file mode 100755 index 00000000..8be3d9ff --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter10.ipynb @@ -0,0 +1,600 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:2cafa3e908c942f24f0641c416de64e3b7ea34b141a866aae200a7ad053e7f3e" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "10 : ARRAYS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "10.2.1,page number:170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import array\n", + "value = [6]\n", + "\n", + "for index in range(0,6):\n", + " print \"Enter Integer\"\n", + " value.append(int(input()))\n", + "for index in range(0,7):\n", + " print \"Integer = \",value[index]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer = 6\n", + "Integer = 4\n", + "Integer = 6\n", + "Integer = 12\n", + "Integer = 6\n", + "Integer = 7\n", + "Integer = 13\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "10.3.1, page number:170" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "value=[6,4,3,2,1]\n", + "for index in xrange(5):\n", + " print \"Integer = \",value[index]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer = 6\n", + "Integer = 4\n", + "Integer = 3\n", + "Integer = 2\n", + "Integer = 1\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "10.3.2, page number:171" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import array\n", + "def MAX_SIZE_CONST():\n", + " return 123\n", + "def TRAILER_CONST():\n", + " return -7777\n", + "value=array.array('i',[])\n", + "print \"Enter upto\",MAX_SIZE_CONST(),\"using\",TRAILER_CONST(),\"as trailer :\"\n", + "print \"\"\n", + "m=0\n", + "for index in range(0,int(MAX_SIZE_CONST())):\n", + " item=int(input())\n", + " if(item == int(TRAILER_CONST())):\n", + " break\n", + " else:\n", + " value.append(item)\n", + " m+=1\n", + "for index in range(0,m):\n", + " print \"Integer =\",value[index]" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter upto 123 using -7777 as trailer :\n", + "\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "2\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-7777\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integer = 1\n", + "Integer = 2\n", + "Integer = 3\n", + "Integer = 4\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "10.4.1, page number:172" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import array\n", + "k=0\n", + "sum=0.0\n", + "def MAX_STUD():\n", + " return 20\n", + "def ENDINP():\n", + " return -9999\n", + "mark=array.array('i',(0 for i in range(0,MAX_STUD())))\n", + "print \"enter upto\",MAX_STUD(),\"marks:\"\n", + "readin=int(input())\n", + "for index in range(0,MAX_STUD()):\n", + " if(readin != ENDINP()):\n", + " mark[index]=readin\n", + " readin=int(input())\n", + " k+=1\n", + "for index in xrange(0,k):\n", + " sum=sum+mark[index]\n", + "print \"Average Mark = \",sum/k\n", + " " + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "enter upto 20 marks:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "34\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "66\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "78\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "65\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "43\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "88\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-9999\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Average Mark = 51.125\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "10.5.1, page number:174" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import array\n", + "def MAX_SIZE():\n", + " return 10\n", + "#str=array.array('i',(0 for i in range(0,MAX_SIZE()+1)))\n", + "print \"Enter the 10 letter word.\"\n", + "str=raw_input()\n", + "r=[]\n", + "for letter in str:\n", + " r.append(letter)\n", + "r.reverse()\n", + "print \"word = \",str\n", + "print \"\".join(r)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the 10 letter word.\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "madurai\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "word = madurai\n", + "iarudam\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "10.6.1, page number:175" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import array\n", + "def MAX_SIZE():\n", + " return 20\n", + "size=0\n", + "variable =array.array('i',[])\n", + "while True:\n", + " print \"Array-size : ?\"\n", + " size=int(input())\n", + " if size>1 and sizei :\n", + " readSize()\n", + " return\n", + "def readArray():\n", + " global size\n", + " global str1\n", + " print \"Enter the Strings..\"\n", + " for k in range(0,size):\n", + " m=raw_input()\n", + " str1.append(m)\n", + " return\n", + "def displayArray1():\n", + " for index in range(0,size):\n", + " print str1[index]\n", + " return\n", + "def displayArray2():\n", + " for index in range(0,size):\n", + " print str2[index]\n", + " return\n", + "def sortedArray():\n", + " global str1\n", + " global str2\n", + " str2= sorted(str1)\n", + " return\n", + "\n", + "readSize()\n", + "readArray()\n", + "print \"The unsorted array is..\"\n", + "displayArray1()\n", + "sortedArray()\n", + "print \"The sorted array is..\"\n", + "displayArray2()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number of strings : 6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the Strings..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "computer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "page\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "diskette\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "eprom\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "binary\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "random\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The unsorted array is..\n", + "computer\n", + "page\n", + "diskette\n", + "eprom\n", + "binary\n", + "random\n", + "The sorted array is..\n", + "binary\n", + "computer\n", + "diskette\n", + "eprom\n", + "page\n", + "random\n" + ] + } + ], + "prompt_number": 9 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter12.ipynb b/Computer_Concepts_and_C_Programming/chapter12.ipynb new file mode 100755 index 00000000..0c2cd2f9 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter12.ipynb @@ -0,0 +1,417 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:057add51225e0c3d10e99246a561a5b527e19bd9c75972f8c282ffbd6b35fbb7" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "12:USER DEFINED FUNCTIONS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.4.1, page number:194" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def get_a_value():\n", + " return float(input())\n", + "print \"Enter the Length..\"\n", + "leng=get_a_value()\n", + "print \"Enter the Width..\"\n", + "width=get_a_value()\n", + "print \"Area = \",leng*width" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the Length..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "16.8\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the Width..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "43.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area = 734.16\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.5.1, page number:195" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def change_index():\n", + " index=5\n", + "index=3\n", + "print \"index = \",index\n", + "change_index()\n", + "print \"index = \",index" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "index = 3\n", + "index = 3\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.5.2, page number:196" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def get_a_value():\n", + " return float(input())\n", + "def calc_area():\n", + " global leng,width\n", + " return leng*width\n", + "print \"Enter the Length..\"\n", + "leng=get_a_value()\n", + "print \"Enter the Width..\"\n", + "width=get_a_value()\n", + "print \"Area = \",calc_area()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the Length..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter the Width..\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area = 296.25\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.6.1, page number:197" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def print_value(k):\n", + " print k\n", + "numb=5\n", + "print \"Value of Expression : \",\n", + "print_value(numb*3+2)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Value of Expression : 17\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.7.1, page number:198" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def TOL():\n", + " return 0.0001\n", + "def sqrt(n):\n", + " if n>0.0:\n", + " guess=0.0\n", + " guess=n/2.0\n", + " while True:\n", + " if ((guess*guess-n) > TOL()) or ((guess*guess-n) < -TOL()):\n", + " temp=guess+n/guess\n", + " guess=temp/2.0\n", + " else:\n", + " break\n", + " return guess\n", + " else:\n", + " return -1.0\n", + " \n", + "numb=float(input(\"Enter number..\"))\n", + "print \"Square Root of\",numb,\"is\",sqrt(numb)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter number..17.1\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Square Root of 17.1 is 4.13521500873\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.8.1, page number:198" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "year=0\n", + "def leap(n):\n", + " return (n%4 == 0)and(n%100 != 0)or(n%400 == 0)\n", + "year=int(input(\"Enter Year..\"))\n", + "if leap(year):\n", + " print year,\"is leap year\"\n", + "else:\n", + " print year,\"is not leap year\"" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.9.1, page number:199" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def input_value():\n", + " return input()\n", + "def area(l,w):\n", + " return l*w\n", + "print \"Length = \"\n", + "length=input_value();\n", + "print \"Width = \"\n", + "width=input_value();\n", + "print \"Area = \",area(length,width)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Length = \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "12.5\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Width = \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "23.7\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Area = 296.25\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "12.9.2, page number:200" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "value=1\n", + "def power(n,e):\n", + " global value\n", + " if(e<0):\n", + " return 0\n", + " for index in range(0,e):\n", + " if(index < e):\n", + " value*=n\n", + " index+=1\n", + " return value\n", + " \n", + "number=int(input(\"Enter Integer...\"))\n", + "exponent=int(input(\"Enter Exponent...\"))\n", + "while True:\n", + " if (exponent<0):\n", + " exponent=input(\"Enter a Non-Negative Integer :\")\n", + " else:\n", + " break\n", + "print number,\"raised to \",exponent,\" = \",power(number,exponent)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer...4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Exponent...2\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "4 raised to 2 = 16\n" + ] + } + ], + "prompt_number": 7 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter13.ipynb b/Computer_Concepts_and_C_Programming/chapter13.ipynb new file mode 100755 index 00000000..0c43b667 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter13.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 diff --git a/Computer_Concepts_and_C_Programming/chapter15.ipynb b/Computer_Concepts_and_C_Programming/chapter15.ipynb new file mode 100755 index 00000000..39ea0685 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter15.ipynb @@ -0,0 +1,384 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:1653abf733b2f9f179249fa6301d56a0dc1802cab84a3f5e0ff6ee96488fe3f6" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "15:FILES" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.4.1, Page number:224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "while True:\n", + " print \"Enter Text\"\n", + " c = raw_input()\n", + " print 'Text entered is:'\n", + " print c\n", + " if c[-1] == '.':\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Text\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C programming language is modern and advanced;\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Text entered is:\n", + "C programming language is modern and advanced;\n", + "Enter Text\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "it enables addressing bits and bytes.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Text entered is:\n", + "it enables addressing bits and bytes.\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.9.1, Page number:224" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def EOF():\n", + " return -1\n", + "while True:\n", + " print \"Enter Text\"\n", + " c = raw_input()\n", + " print 'Text entered is:'\n", + " print c\n", + " if c != EOF():\n", + " break" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Text\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "madurai is a great city ,meenakshi temple is in the heart,millions of pilgrims visit the temple every year.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Text entered is:\n", + "madurai is a great city ,meenakshi temple is in the heart,millions of pilgrims visit the temple every year.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.10.1,page numebr:231" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Key in Text:\"\n", + "f = open('myfile','w')\n", + "c=str(raw_input())\n", + "f.write(c)\n", + "print \"The text is:\"\n", + "f = open('myfile','r')\n", + "print f.read()\n", + "f.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Key in Text:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Madurai city is famous for its historical mounaments and archives,every visitor must see these places.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The text is:\n", + "Madurai city is famous for its historical mounaments and archives,every visitor must see these places.\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.12.1,page numebr:233" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "def file_output(x):\n", + " f=open(x,\"r\")\n", + " print f.read()\n", + "original = open('stud_rec','w')\n", + "copy = open('image','a')\n", + "\n", + "original.write(\"Tirupparankundram\\n\")\n", + "copy.write(\"Tirupparankundram\\n\")\n", + "\n", + "original.close()\n", + "copy.close()\n", + "\n", + "print \"After adding input,stud_rec has: \"\n", + "file_output(\"stud_rec\")\n", + "print \"After append,image contains:\"\n", + "file_output(\"image\")\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "After adding input,stud_rec has: \n", + "Tirupparankundram\n", + "\n", + "After append,image contains:\n", + "Tirupparankundram\n", + "Tirupparankundram\n", + "\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.14.1,page number:237" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Type in the Text:\"\n", + "f = open('madurai','w')\n", + "c=str(raw_input())\n", + "f.write(c)\n", + "print \"The text read as:\"\n", + "f = open('madurai','r')\n", + "print f.read()\n", + "f.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Type in the Text:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "Madurai is an ancient city,ruled by pandyas,Tirumalai nayakar was the last prominent ruler who left many monuments; but meenakshi temple has no age\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The text read as:\n", + "Madurai is an ancient city,ruled by pandyas,Tirumalai nayakar was the last prominent ruler who left many monuments; but meenakshi temple has no age\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.16.1,page number:239" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import os\n", + "import sys\n", + "import fileinput\n", + "import string\n", + "\n", + "print \"Madurai Contains :\"\n", + "f = open('madurai_1','r')\n", + "print f.read()\n", + "f.close()\n", + "\n", + "s = open(\"madurai_1\").read()\n", + "s = s.replace('temple', 'shrine')\n", + "f = open(\"madurai_1\", 'w')\n", + "f.write(s)\n", + "f.close()\n", + "\n", + "print \"Modified File now reads :\"\n", + "f = open('madurai_1','r')\n", + "print f.read()\n", + "f.close()" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Madurai Contains :\n", + "Madurai is an ancient city,ruled by pandyas,Tirumalai nayakar was the last prominent ruler who left many monuments; but meenakshi temple has no age\n", + "\n", + "Modified File now reads :\n", + "Madurai is an ancient city,ruled by pandyas,Tirumalai nayakar was the last prominent ruler who left many monuments; but meenakshi shrine has no age\n", + "\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "15.18.1,page number:241" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import re\n", + "print \"Enter a stream of characters with integers embedded\"\n", + "c=raw_input()\n", + "print \"Integr is : \",re.sub(\"[^0-9]\", \"\", c)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter a stream of characters with integers embedded\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "ab+&473.tce\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Integr is : 473\n" + ] + } + ], + "prompt_number": 8 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter5.ipynb b/Computer_Concepts_and_C_Programming/chapter5.ipynb new file mode 100755 index 00000000..3371a2b1 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter5.ipynb @@ -0,0 +1,50 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:fc199f6967bdaa418c011f64a9259bafc6cecf83675a6e55fed36bd7ff1a9671" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "5:C PROGRAMMING" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "5.3,page number:124" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Welcome to C programming.\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Welcome to C programming.\n" + ] + } + ], + "prompt_number": 1 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter6.ipynb b/Computer_Concepts_and_C_Programming/chapter6.ipynb new file mode 100755 index 00000000..4c020690 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter6.ipynb @@ -0,0 +1,161 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:47d59a62b2c6bacca8aa43f556c3c49e598b6b0b52b3cecb75f5587ebd7d9f66" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "6:CONSTANTS,VARIABLES" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "6.3.1,page number:140" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "m=4\n", + "n=6\n", + "p=8\n", + "result = m+n\n", + "print \"m+n=\",result\n", + "result = int (m/n)\n", + "print \"m/n=\",result\n", + "result = m*p\n", + "print \"m*p=\",result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m+n= 10\n", + "m/n= 0\n", + "m*p= 32\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "6.3.2,page number:141" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "m = 4\n", + "n = 6\n", + "p = 8\n", + "result= round(m+n-p*m+p/n,0)\n", + "print \"m=\",m,\",n=\",n,\",p=\",p\n", + "print \"m + n - p * m + p / n = \",result" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m= 4 ,n= 6 ,p= 8\n", + "m + n - p * m + p / n = -21.0\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "6.3.3,page number:142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "m = 4\n", + "n = 6\n", + "print \" 6 mod 4 = \",n%m\n", + "print \"The modulus operator is : %\"\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " 6 mod 4 = 2\n", + "The modulus operator is : %\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "6.3.4,page number:142" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "m = -4\n", + "n = 6\n", + "p = 8\n", + "print \"m=\",m,\" n=\",n,\" p=\",p\n", + "print \"gives\"\n", + "m=-m\n", + "n=-n\n", + "p=-p\n", + "print \"m=\",m,\" n=\",n,\" p=\",p" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "m= -4 n= 6 p= 8\n", + "gives\n", + "m= 4 n= -6 p= -8\n" + ] + } + ], + "prompt_number": 4 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter7.ipynb b/Computer_Concepts_and_C_Programming/chapter7.ipynb new file mode 100755 index 00000000..25b2623d --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter7.ipynb @@ -0,0 +1,85 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:c5adc1aab2163bdfaad00a9f18852cb6fb30a3af1418e251d196ede7718844fa" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "7.OPERATORS AND EXPRESSION" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "7.4.1,page number:145" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "number = 19+9\n", + "print \"The month of Februry has\",number,\"days\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The month of Februry has 28 days\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "7.8.1,page number:150" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "m = 2\n", + "n = 12.34\n", + "result=m*n\n", + "print m,\"*\",n,\"=\",result\n", + "print result,\"in scientific notation is\",\"{:.2E}\".format(result)\n", + "print m,\"*\",n,\"=\",round(result)" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "2 * 12.34 = 24.68\n", + "24.68 in scientific notation is 2.47E+01\n", + "2 * 12.34 = 25.0\n" + ] + } + ], + "prompt_number": 2 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter8.ipynb b/Computer_Concepts_and_C_Programming/chapter8.ipynb new file mode 100755 index 00000000..02731f67 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter8.ipynb @@ -0,0 +1,139 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:9ca261b12dda6340bfb56a529d7d5db69661ff51a7fd92655edb700a9cae8e3b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "8.MANAGING INPUT AND OUTPUT OPERATORS" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "8.1.1,page number:152" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"tce\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "tce\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "8.2.1,page number:153" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Enter Text :\"\n", + "str=raw_input()\n", + "print \"Text entered is:\\n\",str" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Text :\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "C programming Language is modern and advanced;it enables adressing bits and bytes.\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Text entered is:\n", + "C programming Language is modern and advanced;it enables adressing bits and bytes.\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "8.3.1,page number:155" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Enter an Integer :\"\n", + "number=int(input())\n", + "print \"The Square Of \",number,\"is\",number*number" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter an Integer :\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The Square Of 6 is 36\n" + ] + } + ], + "prompt_number": 3 + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/chapter9.ipynb b/Computer_Concepts_and_C_Programming/chapter9.ipynb new file mode 100755 index 00000000..b93d44a1 --- /dev/null +++ b/Computer_Concepts_and_C_Programming/chapter9.ipynb @@ -0,0 +1,593 @@ +{ + "metadata": { + "name": "", + "signature": "sha256:6065d96194d011c72f0a8e96e52a07b9854f652b99dbacaf2f793d33a2f5e84b" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "heading", + "level": 1, + "metadata": {}, + "source": [ + "9 : DECISION MAKING,BREAKING BRANCHING AND LOOPING" + ] + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.1.1,page number:156" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Type an Integer\"\n", + "numb=int(input())\n", + "if numb<=5:\n", + " print \"Good Choice!\"\n", + "print \"Thank You!\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Type an Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Good Choice!\n", + "Thank You!\n" + ] + } + ], + "prompt_number": 1 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.2.1,page number:157" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Enter year : \"\n", + "year= int(input())\n", + "if year%4 == 0 and year%100 != 0 or year%400 == 0:\n", + " print year,\"is a leap year\"\n", + "else:\n", + " print year,\"is not a leap year\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter year : \n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1990\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1990 is not a leap year\n" + ] + } + ], + "prompt_number": 5 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.4.1,page number : 158" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Enter choice of city(1-4)\"\n", + "city = int(input())\n", + "if city == 1:\n", + " print \"Madurai\"\n", + "elif city == 2:\n", + " print \"Chennai\"\n", + "elif city == 3:\n", + " print \"Mumbai\"\n", + "elif city == 4:\n", + " print \"Calcutta\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter choice of city(1-4)\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "3\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Mumbai\n" + ] + } + ], + "prompt_number": 6 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.6.1,page number : 161" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "import array\n", + "i =20\n", + "variable =array.array('i',[])\n", + "size = 0\n", + "\n", + "def get_array_size():\n", + " print \"Array-size :\"\n", + " global size\n", + " size=int(input())\n", + " if size<1 or size>i :\n", + " get_array_size()\n", + " \n", + "def input_fetch():\n", + " global size\n", + " global variabless\n", + " for k in range(0,size):\n", + " m=int(input())\n", + " variable.append(m)\n", + " return\n", + "\n", + "def sort_list():\n", + " global variable\n", + " variable= array.array('i',sorted(variable))\n", + " \n", + " return\n", + " \n", + "def output():\n", + " for k in range(0,size):\n", + " print variable[k],\n", + " return\n", + "\n", + "def even(number):\n", + " if number/2 == 0:\n", + " return 1\n", + " else:\n", + " return 0\n", + "\n", + "get_array_size()\n", + "input_fetch()\n", + "sort_list()\n", + "print \"The sorted list is :\"\n", + "output()\n", + "print \"\\nMedian : \",\n", + "\n", + "median=round((variable[(size/2)-1]+variable[size/2])/2,3) if even(size) else float(variable[size/2])\n", + "print median" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Array-size :\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "10\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "7\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "8\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "-4\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "0\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "5\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "13\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "17\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "25\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "6\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "The sorted list is :\n", + "-4 0 5 6 6 7 8 13 17 25 \n", + "Median : 7.0\n" + ] + } + ], + "prompt_number": 7 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.8.1,page number:163" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "index = 1\n", + "while index<12:\n", + " print \"This is line \",index\n", + " index+=1\n" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "This is line 1\n", + "This is line 2\n", + "This is line 3\n", + "This is line 4\n", + "This is line 5\n", + "This is line 6\n", + "This is line 7\n", + "This is line 8\n", + "This is line 9\n", + "This is line 10\n", + "This is line 11\n" + ] + } + ], + "prompt_number": 8 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.9.1,page number:164" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Enter Integer\"\n", + "total_sum=0\n", + "numb=int(input())\n", + "while numb>0:\n", + " digit=numb %10\n", + " total_sum+=digit\n", + " numb/=10\n", + "print \"Sum is \",total_sum" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1776\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum is 21\n" + ] + } + ], + "prompt_number": 9 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.9.2,page number:165" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Enter Integer:\"\n", + "numb=int(input())\n", + "print numb,\"is reversed as \",\n", + "while numb>0:\n", + " digit=numb%10\n", + " print digit,\n", + " numb/=10\n", + "print \"\\n\"" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Enter Integer:\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "stream": "stdout", + "text": [ + "1234\n" + ] + }, + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "1234 is reversed as 4 3 2 1 \n", + "\n" + ] + } + ], + "prompt_number": 10 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.10.1,page number:166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "for index in range(1,11):\n", + " print \" line \",index" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + " line 1\n", + " line 2\n", + " line 3\n", + " line 4\n", + " line 5\n", + " line 6\n", + " line 7\n", + " line 8\n", + " line 9\n", + " line 10\n" + ] + } + ], + "prompt_number": 2 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.10.2,page number:166" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "print \"Result\"\n", + "print \"Index Index Squared\"\n", + "print \"_____ _____________\"\n", + "for index in range(1,11):\n", + " print index,\" \",index*index" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Result\n", + "Index Index Squared\n", + "_____ _____________\n", + "1 1\n", + "2 4\n", + "3 9\n", + "4 16\n", + "5 25\n", + "6 36\n", + "7 49\n", + "8 64\n", + "9 81\n", + "10 100\n" + ] + } + ], + "prompt_number": 3 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [ + "9.10.3,page number:167" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "total_sum=0\n", + "value=100\n", + "for index in range(1,value+1):\n", + " total_sum+=index\n", + "print \"Sum of 1 to \",value,\" = \",total_sum" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Sum of 1 to 100 = 5050\n" + ] + } + ], + "prompt_number": 4 + }, + { + "cell_type": "heading", + "level": 2, + "metadata": {}, + "source": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file diff --git a/Computer_Concepts_and_C_Programming/screenshots/chapter10.png b/Computer_Concepts_and_C_Programming/screenshots/chapter10.png new file mode 100755 index 00000000..0c73944f Binary files /dev/null and b/Computer_Concepts_and_C_Programming/screenshots/chapter10.png differ diff --git a/Computer_Concepts_and_C_Programming/screenshots/chapter12.png b/Computer_Concepts_and_C_Programming/screenshots/chapter12.png new file mode 100755 index 00000000..f6b00405 Binary files /dev/null and b/Computer_Concepts_and_C_Programming/screenshots/chapter12.png differ diff --git a/Computer_Concepts_and_C_Programming/screenshots/chapter9.png b/Computer_Concepts_and_C_Programming/screenshots/chapter9.png new file mode 100755 index 00000000..f395eaae Binary files /dev/null and b/Computer_Concepts_and_C_Programming/screenshots/chapter9.png differ -- cgit