summaryrefslogtreecommitdiff
path: root/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb
diff options
context:
space:
mode:
authorkinitrupti2017-05-12 18:40:35 +0530
committerkinitrupti2017-05-12 18:40:35 +0530
commit64d949698432e05f2a372d9edc859c5b9df1f438 (patch)
tree012fd5b4ac9102cdcf5bc56305e49d6714fa5951 /Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb
parent9c6ab8cbf3e1a84c780386abf4852d84cdd32d56 (diff)
downloadPython-Textbook-Companions-64d949698432e05f2a372d9edc859c5b9df1f438.tar.gz
Python-Textbook-Companions-64d949698432e05f2a372d9edc859c5b9df1f438.tar.bz2
Python-Textbook-Companions-64d949698432e05f2a372d9edc859c5b9df1f438.zip
Revised list of TBCs
Diffstat (limited to 'Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb')
-rwxr-xr-xComputer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb384
1 files changed, 0 insertions, 384 deletions
diff --git a/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb b/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb
deleted file mode 100755
index 39ea0685..00000000
--- a/Computer_Concepts_and_C_Programming_by_R.Rajaram/chapter15_4.ipynb
+++ /dev/null
@@ -1,384 +0,0 @@
-{
- "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