diff options
Diffstat (limited to 'Let_us_C')
-rw-r--r-- | Let_us_C/chapter-1.ipynb | 9 | ||||
-rw-r--r-- | Let_us_C/chapter-10.ipynb | 16 | ||||
-rw-r--r-- | Let_us_C/chapter-11.ipynb | 10 | ||||
-rw-r--r-- | Let_us_C/chapter-12.ipynb | 17 | ||||
-rw-r--r-- | Let_us_C/chapter-13.ipynb | 1 | ||||
-rw-r--r-- | Let_us_C/chapter-14.ipynb | 9 | ||||
-rw-r--r-- | Let_us_C/chapter-15.ipynb | 19 | ||||
-rw-r--r-- | Let_us_C/chapter-16.ipynb | 1 | ||||
-rw-r--r-- | Let_us_C/chapter-17.ipynb | 3 | ||||
-rw-r--r-- | Let_us_C/chapter-18.ipynb | 6 | ||||
-rw-r--r-- | Let_us_C/chapter-2.ipynb | 17 | ||||
-rw-r--r-- | Let_us_C/chapter-20.ipynb | 6 | ||||
-rw-r--r-- | Let_us_C/chapter-21.ipynb | 7 | ||||
-rw-r--r-- | Let_us_C/chapter-3.ipynb | 11 | ||||
-rw-r--r-- | Let_us_C/chapter-4.ipynb | 12 | ||||
-rw-r--r-- | Let_us_C/chapter-5.ipynb | 27 | ||||
-rw-r--r-- | Let_us_C/chapter-6.ipynb | 11 | ||||
-rw-r--r-- | Let_us_C/chapter-7.ipynb | 4 | ||||
-rw-r--r-- | Let_us_C/chapter-8.ipynb | 26 | ||||
-rw-r--r-- | Let_us_C/chapter-9.ipynb | 17 |
20 files changed, 0 insertions, 229 deletions
diff --git a/Let_us_C/chapter-1.ipynb b/Let_us_C/chapter-1.ipynb index 19d3a98f..5c48f867 100644 --- a/Let_us_C/chapter-1.ipynb +++ b/Let_us_C/chapter-1.ipynb @@ -26,8 +26,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''calculate simple interest for a set of values representing principle,\n",
- "number of years and rate of interest.'''\n",
"\n",
"#Variable declaration\n",
"p = 1000 #principle\n",
@@ -64,8 +62,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''calculate simple interest by inputing principle,\n",
- "number of years and rate of interest from the user.'''\n",
"\n",
"#Input from the user\n",
"#p,n,r = raw_input(\"Enter values of p, n, r : \").split()\n",
@@ -103,7 +99,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Just for fun. Author: Bozo'''\n",
"\n",
"#Input from the user\n",
"#num = raw_input(\"Enter a number : \")\n",
@@ -138,8 +133,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the hierarchy of operations and evaluate the following expression:\n",
- "i = 2 * 3 / 4 + 4 / 4 + 8 - 2 + 5 / 8'''\n",
"\n",
"#Calculation\n",
"i1 = 2 * 3 # operation *\n",
@@ -179,8 +172,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Determine the hierarchy of operations and evaluate the following expression:\n",
- "kk = 3 / 2 * 4 + 3 / 8 + 3'''\n",
"\n",
"#Calculation\n",
"kk1 = 3 / 2# operation /\n",
diff --git a/Let_us_C/chapter-10.ipynb b/Let_us_C/chapter-10.ipynb index db8bf067..93132187 100644 --- a/Let_us_C/chapter-10.ipynb +++ b/Let_us_C/chapter-10.ipynb @@ -25,8 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to store data about 3 books that is their name\n",
- "(a string), price (a float) and number of pages (an int).'''\n",
"\n",
"#Variable declaration\n",
"name = []\n",
@@ -82,8 +80,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to store data about 3 books that is their name\n",
- "(a string), price (a float) and number of pages (an int).'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -143,8 +139,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that elements of a structure,\n",
- "are always stored in contiguous memory locations'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -184,7 +178,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to show how to use an array of structures.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -240,9 +233,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that values of a structure variable can be\n",
"assigned to another structure variable of the same type\n",
- "using the assignment operator.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -294,7 +285,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate nested structures at work.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -334,8 +324,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the method of passing individual structure elements to\n",
- "functions'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -375,8 +363,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the method of passing \n",
- "the entire structure variable to a function'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -416,7 +402,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates the usage of a structure pointer.'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintions\n",
@@ -455,7 +440,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates passing address of a structure variable'''\n",
"\n",
"#function definition\n",
"def display (b):\n",
diff --git a/Let_us_C/chapter-11.ipynb b/Let_us_C/chapter-11.ipynb index 4f966f44..6e6a2bf4 100644 --- a/Let_us_C/chapter-11.ipynb +++ b/Let_us_C/chapter-11.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing a formatted string using printf function'''\n",
"\n",
"#Variable declaration\n",
"avg = 346 \n",
@@ -59,7 +58,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing using format specifiers in printf function'''\n",
"\n",
"#Variable declaration\n",
"weight = 63\n",
@@ -99,7 +97,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing using format specifiers in printf function'''\n",
"\n",
"#Variable declaration\n",
"firstname1 = \"Sandy\" \n",
@@ -136,8 +133,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrateshows usage of \\n and a\n",
- "new escape sequence \\t, called \u2018tab\u2019'''\n",
"\n",
"#Result\n",
"print \"You\\tmust\\tbe\\tcrazy\\nto\\thate\\tthis\\tbook\" \n"
@@ -167,7 +162,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to perform the specified conversion using printf function'''\n",
"\n",
"#Variable declaration\n",
"ch = 'z' \n",
@@ -209,7 +203,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of sprintf function'''\n",
"\n",
"#Variable declaration\n",
"i = 10 \n",
@@ -248,7 +241,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of unformatted input functions'''\n",
"\n",
"import msvcrt\n",
"\n",
@@ -298,7 +290,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of unformatted output functions'''\n",
"\n",
"#Variable declaration\n",
"ch = 'A'\n",
@@ -340,7 +331,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of gets and puts functions'''\n",
"\n",
"#Input from user\n",
"#footballer = input(\"Enter name\" ) # puts(\"Enter name \") ; gets(footballer)\n",
diff --git a/Let_us_C/chapter-12.ipynb b/Let_us_C/chapter-12.ipynb index f0567d09..a3331f4d 100644 --- a/Let_us_C/chapter-12.ipynb +++ b/Let_us_C/chapter-12.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display contents of a file on screen.'''\n",
"\n",
"fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n",
"while ( 1 ):\n",
@@ -1582,8 +1581,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to check whether a file has been opened successfully before\n",
- "trying to read or write to the file'''\n",
"\n",
"try :\n",
" fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" )#open file in read mode and check if file is opened successfully\n",
@@ -1617,7 +1614,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to count chars, spaces, tabs and newlines in a file.'''\n",
"\n",
"#Variable declaration\n",
"nol = 0\n",
@@ -1673,8 +1669,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to take the contents of a file and\n",
- "copy them into another file, character by character.'''\n",
"\n",
"fs = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n",
"if(not fs):\n",
@@ -1714,7 +1708,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to receive strings from keyboard and write them to file'''\n",
"\n",
"fp = open ( \"C:/Users/Akshatha M/Desktop/temp.txt\", \"w\" ) #open file in write mode\n",
"if(not fp):\n",
@@ -1759,7 +1752,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to reads strings from the file and displays them on screen.'''\n",
"\n",
"fp = open (\"C:/Users/Akshatha M/Desktop/carrot.txt\", \"r\" ) #open file in read mode\n",
"if ( not fp ):\n",
@@ -1839,7 +1831,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to write records to a file using structure'''\n",
"\n",
"from collections import namedtuple\n",
"\n",
@@ -1899,7 +1890,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to read records from a file using structure'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -1947,7 +1937,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to copy text as well as binary files'''\n",
"\n",
"fs = open (\"C:/Users/Akshatha M/Desktop/Project1.exe\", \"rb\" ) #open file in read binary mode\n",
"if(not fs):\n",
@@ -1987,7 +1976,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to receive records from keyboard and write them to a file in binary mode'''\n",
"\n",
"from collections import namedtuple\n",
"\n",
@@ -2050,7 +2038,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to read records from binary file and displays them on VDU'''\n",
"\n",
"from collections import namedtuple\n",
"#Structure defintion\n",
@@ -2098,7 +2085,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''A menu-driven program for elementary database management'''\n",
"\n",
"import os\n",
"from collections import namedtuple\n",
@@ -2202,7 +2188,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''File-copy program which copies text, .com and .exe files'''\n",
"\n",
"#source=input( \"Enter source file name \" ) \n",
"print \"Enter source file name \" \n",
@@ -2267,7 +2252,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''A program that illustrates the usage of ferror( )'''\n",
"\n",
"\n",
"fp = open ( \"C:/Users/Akshatha/Documents/extrastuff/skills.txt\", \"w\" ) \n",
@@ -2305,7 +2289,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''A program to write a file to a printer'''\n",
"\n",
"import io\n",
"\n",
diff --git a/Let_us_C/chapter-13.ipynb b/Let_us_C/chapter-13.ipynb index d3b93ca6..bd79a9c1 100644 --- a/Let_us_C/chapter-13.ipynb +++ b/Let_us_C/chapter-13.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''File-copy program usinng command line arguments'''\n",
"\n",
"import sys\n",
"\n",
diff --git a/Let_us_C/chapter-14.ipynb b/Let_us_C/chapter-14.ipynb index becf792e..8181a680 100644 --- a/Let_us_C/chapter-14.ipynb +++ b/Let_us_C/chapter-14.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print binary equivalent of integers using showbits( ) function'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -170,7 +169,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to shows one\u2019s complement operator in action.'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -351,7 +349,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate file encryption utility'''\n",
"\n",
"#Function definition\n",
"def encrypt( ):\n",
@@ -389,7 +386,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the effect of right shift operator.'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -556,7 +552,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the effect of left shift operator.'''\n",
"\n",
"#Function definition\n",
"def showbits ( n ):\n",
@@ -723,7 +718,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to decode the date field in directory entry using bitwise operators'''\n",
"\n",
"#Variable declaration\n",
"d = 9\n",
@@ -767,7 +761,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to test whether a bit in a number is ON or OFF'''\n",
"\n",
"#Variable declaration\n",
"i = 65\n",
@@ -812,8 +805,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that a number XORed with another number\n",
- "twice gives the original number.'''\n",
"\n",
"#Variable declaration\n",
"b = 50\n",
diff --git a/Let_us_C/chapter-15.ipynb b/Let_us_C/chapter-15.ipynb index bf1ab52b..993f6a9b 100644 --- a/Let_us_C/chapter-15.ipynb +++ b/Let_us_C/chapter-15.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print a payroll using enum'''\n",
"\n",
"def enum(**enums):\n",
" return type('Enum', (), enums)\n",
@@ -82,7 +81,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to achieve the task of enums using macros'''\n",
"\n",
"#macro definition\n",
"ASSEMBLY = 0\n",
@@ -114,7 +112,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate no typecasting'''\n",
"\n",
"#Variable declaration\n",
"x=6\n",
@@ -150,7 +147,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate explicit typecasting'''\n",
"\n",
"#Variable declaration\n",
"x=6\n",
@@ -186,7 +182,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate typecasting'''\n",
"\n",
"#Variable declaration\n",
"a=6.35\n",
@@ -220,7 +215,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate bit fields in structures'''\n",
"\n",
"from ctypes import *\n",
"import ctypes\n",
@@ -276,7 +270,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate pointers to functions'''\n",
"\n",
"#Function definition\n",
"def display():\n",
@@ -311,7 +304,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to invoke a function using a pointer to a function'''\n",
"\n",
"#Function definition\n",
"def display():\n",
@@ -346,7 +338,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate functions returning pointers'''\n",
"\n",
"#Function definition\n",
"def fun():\n",
@@ -372,8 +363,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program which copies one string into another and\n",
- "returns the pointer to the target string'''\n",
"\n",
"#Function definition\n",
"def copy(t,s):\n",
@@ -415,9 +404,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a findmax() function\n",
"to find out max value from a set of values\n",
- "irrespective of number of values passed to it'''\n",
"\n",
"#function declaration\n",
"def findmax(*arg):\n",
@@ -459,8 +446,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a display() function\n",
- "to print any number of arguments of any type'''\n",
"\n",
"#function declaration\n",
"def display(*arg):\n",
@@ -514,7 +499,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a union at work'''\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -544,8 +528,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that we cant assign different values to\n",
- "different union element at the same time'''\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -580,7 +562,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate structures nested in a union'''\n",
"\n",
"from ctypes import *\n",
"\n",
diff --git a/Let_us_C/chapter-16.ipynb b/Let_us_C/chapter-16.ipynb index 8c3c03f2..195741f0 100644 --- a/Let_us_C/chapter-16.ipynb +++ b/Let_us_C/chapter-16.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display a \u201cHello\u201d message in a message box'''\n",
"\n",
"import ctypes\n",
"MessageBox = ctypes.windll.user32.MessageBoxW\n",
diff --git a/Let_us_C/chapter-17.ipynb b/Let_us_C/chapter-17.ipynb index 1b6a9007..ea406a32 100644 --- a/Let_us_C/chapter-17.ipynb +++ b/Let_us_C/chapter-17.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create a window on the screen.'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -55,7 +54,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create several windows on the screen'''\n",
"\n",
"from tkinter import *\n",
"root = []\n",
@@ -85,7 +83,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create a window using window class and interact with it'''\n",
"\n",
"from tkinter import *\n",
"\n",
diff --git a/Let_us_C/chapter-18.ipynb b/Let_us_C/chapter-18.ipynb index 7a30b0b6..3aa35505 100644 --- a/Let_us_C/chapter-18.ipynb +++ b/Let_us_C/chapter-18.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display a message \u201cHello Windows\u201d in different fonts'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -65,7 +64,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that displays different shapes in a window'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -105,8 +103,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to create pens of different style, color and\n",
- "thickness to draw'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -205,7 +201,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to display a image in a window.'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -233,7 +228,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a animation of a ball bouncing off a window '''\n",
"from visual import *\n",
"\n",
"floor = box(length=4, height=0.5, width=4, color=color.blue)\n",
diff --git a/Let_us_C/chapter-2.ipynb b/Let_us_C/chapter-2.ipynb index fc025445..e2379edc 100644 --- a/Let_us_C/chapter-2.ipynb +++ b/Let_us_C/chapter-2.ipynb @@ -25,8 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Demonstration of if statement\n",
- "Here is a simple program, which demonstrates the use of if and the relational operators'''\n",
"\n",
"#taking in input from the user\n",
"#num = raw_input(\"Enter a number less than 10: \")\n",
@@ -64,8 +62,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''While purchasing certain items, a discount of 10% is offered if the quantity purchased is more than 1000.\n",
- "If quantity and price per item are input through the keyboard, write a program to calculate the total expenses.'''\n",
"\n",
"#Variable declaration\n",
"dis = 0 #Initial Discount (%0)\n",
@@ -113,9 +109,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''The current year and the year in which the employee joined the organization are entered through the keyboard.\n",
"If the number of years for which the employee has served the organization is greater than 3 then a bonus of Rs. 2500/- is given to the employee.\n",
- "If the years of service are not greater than 3, then the program should do nothing'''\n",
"\n",
"#input from user\n",
"#cy,yoj = raw_input(\"Enter current year and year of joining: \").split() \n",
@@ -157,10 +151,8 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''In a company an employee is paid as under:\n",
"If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and\n",
"DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary.\n",
- "If the employee's salary is input through the keyboard ,write a program to find his gross salary.'''\n",
"\n",
"#input from user\n",
"#bs = raw_input(\"Enter basic salary: \")\n",
@@ -207,7 +199,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''A quick demo of nested if-else'''\n",
"\n",
"#input from user\n",
"#i = raw_input(\"Enter either 1 or 2: \")\n",
@@ -250,13 +241,11 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:\n",
"Percentage above or equal to 60 - First division\n",
"Percentage between 50 and 59 - Second division\n",
"Percentage between 40 and 49 - Third division\n",
"Percentage less than 40 - Fail\n",
"Write a program to calculate the division obtained by the student.\n",
- "Method 1'''\n",
"\n",
"#input from user\n",
"#m1,m2,m3,m4,m5 = raw_input(\"Enter marks in five subjects: \").split() \n",
@@ -309,7 +298,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Method 2'''\n",
"\n",
"#input from user\n",
"#m1,m2,m3,m4,m5 = raw_input(\"Enter marks in five subjects: \").split() \n",
@@ -363,7 +351,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Method 3 - else if ladder demo'''\n",
"\n",
"#input from user\n",
"#m1,m2,m3,m4,m5 = raw_input(\"Enter marks in five subjects: \").split() \n",
@@ -414,12 +401,10 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''A company insures its drivers in the following cases:\n",
"\u2212 If the driver is married.\n",
"\u2212 If the driver is unmarried, male & above 30 years of age.\n",
"\u2212 If the driver is unmarried, female & above 25 years of age.\n",
"In all other cases the driver is not insured.\n",
- "If the marital status, sex and age of the driver are the inputs, write a program to determine whether the driver is to be insured or not.'''\n",
"\n",
"#input from user\n",
"#age,sex,ms = raw_input(\"Enter age, sex, marital status: \").split() # Age , sex and marital status of the driver\n",
@@ -470,7 +455,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Using logical operators'''\n",
"\n",
"#input from user\n",
"#age,sex,ms = raw_input(\"Enter age, sex, marital status: \").split() # Age , sex and marital status of the driver\n",
@@ -512,7 +496,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Write a program to calculate the salary as per the given table'''\n",
"\n",
"#Input gender( m/f), years of service and qualification from the user\n",
"#g,yos,qual = raw_input(\"Enter Gender, Years of Service and Qualifications ( 0 = G, 1 = PG ):\").split()\n",
diff --git a/Let_us_C/chapter-20.ipynb b/Let_us_C/chapter-20.ipynb index 52b3cd37..16c8fdc8 100644 --- a/Let_us_C/chapter-20.ipynb +++ b/Let_us_C/chapter-20.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate how to create a child process'''\n",
"\n",
"import os\n",
"\n",
@@ -50,7 +49,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate how to create a child process'''\n",
"\n",
"import os\n",
"\n",
@@ -76,7 +74,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to get the pids of parent and child processes'''\n",
"\n",
"import os\n",
"from multiprocessing import Process\n",
@@ -115,7 +112,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that uses execl( ) to run a new program in the child process.'''\n",
"\n",
"import os\n",
"\n",
@@ -143,8 +139,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that gets the exit code\n",
- "of the terminated process and thereby ensures a proper cleanup.'''\n",
"\n",
"import os\n",
"\n",
diff --git a/Let_us_C/chapter-21.ipynb b/Let_us_C/chapter-21.ipynb index 7cf37612..9883bc71 100644 --- a/Let_us_C/chapter-21.ipynb +++ b/Let_us_C/chapter-21.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to prevent the termination of a program even after hitting Ctrl + C'''\n",
"\n",
"import signal, os\n",
"\n",
@@ -52,7 +51,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to handle multiple signals.'''\n",
"\n",
"import signal, os\n",
"\n",
@@ -88,8 +86,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a common signal handler to handle all signals\n",
- "instead of registering a separate handler for each signal'''\n",
"\n",
"import signal, os\n",
"\n",
@@ -123,7 +119,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to understand signal blocking '''\n",
"\n",
"import signal, os\n",
"\n",
@@ -164,7 +159,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that uses GTK toolkit to create a window on the screen.'''\n",
"\n",
"from tkinter import *\n",
"\n",
@@ -198,7 +192,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to draw a few shapes in a window'''\n",
"\n",
"from tkinter import *\n",
"\n",
diff --git a/Let_us_C/chapter-3.ipynb b/Let_us_C/chapter-3.ipynb index eae87c95..5b3de0d9 100644 --- a/Let_us_C/chapter-3.ipynb +++ b/Let_us_C/chapter-3.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculation of simple interest for 3 sets of p, n and r (while loop)'''\n",
"\n",
"#Variable declaration\n",
"count = 1\n",
@@ -77,7 +76,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Calculation of simple interest for 3 sets of p, n and r (for loop)'''\n",
"\n",
"pr = [1000,2000,3500]\n",
"yr = [5,5,5]\n",
@@ -123,7 +121,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Demonstration of nested loops'''\n",
"\n",
"#nested for loops\n",
"for r in range(1,4): #outer loop\n",
@@ -161,7 +158,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Execution of a loop an unknown number of times'''\n",
"\n",
"#do while loop\n",
"while True:\n",
@@ -203,7 +199,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''odd loop using a for loop'''\n",
"\n",
"#Variable declaration\n",
"another = 'y'\n",
@@ -250,7 +245,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''odd loop using a while loop'''\n",
"\n",
"#Variable declaration\n",
"another = 'y'\n",
@@ -292,8 +286,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Write a program to determine whether a number is prime or not.\n",
- "A prime number is one, which is divisible only by 1 or itself.'''\n",
"\n",
"#Input from user\n",
"#num = raw_input(\"Enter a number: \")\n",
@@ -337,8 +329,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''The following program illustrates the fact that the keyword break,\n",
- "breaks the control only from the loop in which it is placed.'''\n",
"\n",
"#Variable declaration\n",
"i = 1\n",
@@ -577,7 +567,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''The following program illustrates the use of the 'continue' statement'''\n",
"\n",
"#for loops\n",
"for i in range(1,3):\n",
diff --git a/Let_us_C/chapter-4.ipynb b/Let_us_C/chapter-4.ipynb index d6b348c1..75a56ab9 100644 --- a/Let_us_C/chapter-4.ipynb +++ b/Let_us_C/chapter-4.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate switch-case control structure(without break)'''\n",
"\n",
"#Variable declaration\n",
"i = 2\n",
@@ -65,7 +64,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate switch-case control structure'''\n",
"\n",
"#Variable declaration\n",
"i = 2\n",
@@ -104,7 +102,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''An example of scrambled case order'''\n",
"\n",
"#Variable declaration\n",
"i = 22\n",
@@ -143,7 +140,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''An example which shows the use of 'char' values in case and switch'''\n",
"\n",
"#Variable declaration\n",
"c = 'x'\n",
@@ -182,8 +178,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''An example which shows how to execute a common set of statements for\n",
- "multiple cases.'''\n",
"\n",
"#Input from user\n",
"#ch = raw_input(\"Enter any of the alphabet a, b, or c : \")\n",
@@ -223,9 +217,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''An example that shows every statement in a switch must belong to some \n",
"case or the other. If it doesn\u2019t,the compiler won\u2019t report an error.\n",
- "However, the statement would never get executed.'''\n",
"\n",
"#Input from user\n",
"#i = raw_input(\"Enter value of i \")\n",
@@ -255,8 +247,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program shows how to use goto statement'''\n",
- "'''Python doesnt support statements like 'goto' '''\n",
"#Input from user\n",
"#goals = raw_input(\"Enter the number of goals scored against India: \")\n",
"goals = 3\n",
@@ -292,9 +282,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''The following program illustrates the usage of 'goto'\n",
"when we want to take the control out of the loop that is contained in\n",
- "several other loops.'''\n",
"\n",
"\n",
"#nested for loops\n",
diff --git a/Let_us_C/chapter-5.ipynb b/Let_us_C/chapter-5.ipynb index 62f0970a..76227dd0 100644 --- a/Let_us_C/chapter-5.ipynb +++ b/Let_us_C/chapter-5.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a simple function'''\n",
"\n",
"# function definition\n",
"def message():\n",
@@ -59,7 +58,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a call to more than one function'''\n",
"\n",
"# function definitions\n",
"def italy():\n",
@@ -105,7 +103,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate a call to more than one function'''\n",
"\n",
"# function definitions\n",
"def argentina():\n",
@@ -154,7 +151,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate sending and receiving values between functions'''\n",
"\n",
"# function definition\n",
"def calsum ( x, y, z ):\n",
@@ -201,10 +197,8 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that there is no restriction on the number of return\n",
"statements that may be present in a function.\n",
"Also, the return statement need not always be present at the end of the called\n",
- "function.'''\n",
"\n",
"# function definition\n",
"def fun():\n",
@@ -240,9 +234,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate that If the value of a formal argument is\n",
"changed in the called function, the corresponding\n",
- "change does not take place in the calling function.'''\n",
"\n",
"# function definition\n",
"def fun(b):\n",
@@ -278,7 +270,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate Scope Rule of Functions'''\n",
"\n",
"# function definition\n",
"def display(j):\n",
@@ -314,7 +305,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to find out square of a number using a function.'''\n",
"\n",
"# function definition\n",
"def square(x):\n",
@@ -358,8 +348,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a called function without returning any value using\n",
- "the keyword void.'''\n",
"\n",
"# function definition\n",
"def gospel(): # void function\n",
@@ -397,7 +385,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print the address of a variable'''\n",
"\n",
"#Variable declaration\n",
"i = 3\n",
@@ -431,8 +418,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates the relationships between pointers , variables\n",
- "and addresses'''\n",
"\n",
"#Variable declaration\n",
"i = 3 \n",
@@ -477,8 +462,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that demonstrates a pointer that\n",
- "points to another pointer'''\n",
"\n",
"#Variable declaration\n",
"i = 3\n",
@@ -534,7 +517,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the \u2018Call by Value\u2019 method of passing arguments'''\n",
"\n",
"# function definition\n",
"def swapv (x,y):\n",
@@ -575,7 +557,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the \u2018Call by Reference\u2019 method of passing arguments'''\n",
"\n",
"# function definition\n",
"def swapv (a,b):\n",
@@ -615,8 +596,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate how to use a call by reference to make a function\n",
- "return more than one value at a time, which is not possible ordinarily.'''\n",
"\n",
"#Input from user\n",
"#radius = raw_input(\"Enter radius of a circle: \" )\n",
@@ -664,8 +643,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a non-recursive function for calculating\n",
- "the factorial value of an integer'''\n",
"\n",
"# function definition\n",
"def factorial(x):\n",
@@ -711,8 +688,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a the recursive version of\n",
- "the function to calculate the factorial value.'''\n",
"\n",
"# function definition\n",
"def rec(x):\n",
@@ -759,8 +734,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the use of a stack for\n",
- "implementing function calls'''\n",
"\n",
"#Variable declaration\n",
"a = 5\n",
diff --git a/Let_us_C/chapter-6.ipynb b/Let_us_C/chapter-6.ipynb index 7cf66240..8234fda0 100644 --- a/Let_us_C/chapter-6.ipynb +++ b/Let_us_C/chapter-6.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the range of char'''\n",
"\n",
"#Variable declaration\n",
"ch = 291\n",
@@ -57,7 +56,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the range of an unsigned char'''\n",
"\n",
"for ch in range(0,256):\n",
" print \"%d %c\" %(ch, ch%128 )\n",
@@ -354,7 +352,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the scope and life of an automatic variable'''\n",
"\n",
"#Variable declaration\n",
"i = 1 #auto int\n",
@@ -401,7 +398,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the scope and life of an automatic variable'''\n",
"\n",
"#Variable declaration\n",
"i = 1 #auto int\n",
@@ -450,7 +446,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that puts to use all the data types'''\n",
"\n",
"#char\n",
"#c,d = raw_input(\"char: \").split()\n",
@@ -513,8 +508,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to understand the difference\n",
- "between the automatic and static storage classes.'''\n",
"\n",
"#function definition \n",
"def increment( ):\n",
@@ -553,8 +546,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to understand the difference\n",
- "between the automatic and static storage classes.'''\n",
"\n",
"#function definition \n",
"def increment(i = [1]): #static int \n",
@@ -592,7 +583,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the advantages of using static storage class'''\n",
"\n",
"\n",
"#function definition\n",
@@ -627,7 +617,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the extrnal storage class'''\n",
"\n",
"#Variable declaration \n",
"i = [0] # external variable\n",
diff --git a/Let_us_C/chapter-7.ipynb b/Let_us_C/chapter-7.ipynb index 9024266b..960282bf 100644 --- a/Let_us_C/chapter-7.ipynb +++ b/Let_us_C/chapter-7.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros'''\n",
"\n",
"#Macro declaration\n",
"UPPER = 25\n",
@@ -81,7 +80,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros'''\n",
"\n",
"#Macro declaration\n",
"PI = 3.1415\n",
@@ -119,7 +117,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros with arguments'''\n",
"\n",
"#Macro declaration\n",
"def AREA(x): #define AREA(x) ( 3.14 * x * x )\n",
@@ -166,7 +163,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate macros with arguments'''\n",
"\n",
"#Macro declaration\n",
"def ISDIGIT(y): #define ISDIGIT(y) ( y >= 48 && y <= 57 )\n",
diff --git a/Let_us_C/chapter-8.ipynb b/Let_us_C/chapter-8.ipynb index 3c03d537..9467d28a 100644 --- a/Let_us_C/chapter-8.ipynb +++ b/Let_us_C/chapter-8.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to find average marks obtained by a class of 30 students in a test'''\n",
"\n",
"#Variable declaration\n",
"s = 0\n",
@@ -102,8 +101,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate call by value by passing values of\n",
- "array elements to the function'''\n",
"\n",
"#Funcion definition\n",
"def display(m):\n",
@@ -145,8 +142,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate call by reference by passing values of\n",
- "array elements to the function'''\n",
"\n",
"#Funcion definition\n",
"def display(n):\n",
@@ -189,8 +184,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the relationship between\n",
- "pointers and arrays'''\n",
"\n",
"#Variable declaration\n",
"i = 3\n",
@@ -250,8 +243,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to calculate the number of bytes\n",
- "separating the corresponding array elements'''\n",
"\n",
"#Variable declaration\n",
"arr = [ 10, 20, 30, 45, 67, 56, 74 ]\n",
@@ -285,7 +276,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate comparison of 2 pointer variables'''\n",
"\n",
"#Variable declaration\n",
"arr = [ 10, 20, 36, 72, 45, 36 ]\n",
@@ -322,8 +312,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program that prints out the memory locations\n",
- "in which the elements of the array are stored'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -368,7 +356,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program shows a way in which we can access the elements of an array.'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -413,8 +400,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program shows a way in which we can access the elements of an array using\n",
- "pointers'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -461,7 +446,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the of passing an entire array to a function'''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17 ]\n",
@@ -504,7 +488,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate accessing array elements in different ways '''\n",
"\n",
"#Variable declaration\n",
"num = [ 24, 34, 12, 44, 56, 17]\n",
@@ -555,7 +538,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate two dimensional arrays'''\n",
"\n",
"#Variable declaration\n",
"stud = [] #array\n",
@@ -607,7 +589,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that a 2-D array is an array of arrays '''\n",
"\n",
"#Variable declaration\n",
"s = [ [1234, 56 ], [ 1212, 33], [ 1434, 80 ], [ 1312, 78 ]]\n",
@@ -643,8 +624,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the use of pointer\n",
- "notation to access 2-D array elements'''\n",
"\n",
"#Variable declaration\n",
"s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ] ]\n",
@@ -684,7 +663,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the usage of pointer to an array'''\n",
"\n",
"#Variable declaration\n",
"s = [ [ 1234, 56 ], [ 1212, 33 ], [ 1434, 80 ], [ 1312, 78 ]]\n",
@@ -736,7 +714,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate three ways of accessing a 2-D array'''\n",
"\n",
"#Variable declaration\n",
"a = [[1, 2, 3, 4] , [5, 6, 7, 8] , [9, 0, 1, 6 ]]\n",
@@ -853,7 +830,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate an array of pointers'''\n",
"\n",
"from ctypes import *\n",
"\n",
@@ -898,8 +874,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate that an array of pointers can even\n",
- "contain the addresses of other arrays'''\n",
"\n",
"#Variable declaration\n",
"a = [ 0, 1, 2, 3, 4 ]\n",
diff --git a/Let_us_C/chapter-9.ipynb b/Let_us_C/chapter-9.ipynb index 1f588a47..e74e2dd8 100644 --- a/Let_us_C/chapter-9.ipynb +++ b/Let_us_C/chapter-9.ipynb @@ -25,7 +25,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing of a string'''\n",
"\n",
"#Variable declaration\n",
"name= \"Klinsman\" # character array or string\n",
@@ -67,7 +66,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate printing of a string'''\n",
"\n",
"#Variable declaration\n",
"name= \"Klinsman\\0\" # character array or string\n",
@@ -109,7 +107,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to print a string using a pointer to access the array elements'''\n",
"\n",
"#Variable declaration\n",
"name = \"Klinsman\\0\" # string or character array\n",
@@ -153,7 +150,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strlen' function '''\n",
"\n",
"\n",
"#Variable declaration\n",
@@ -192,8 +188,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a function that\n",
- "counts the number of characters present in a string'''\n",
"\n",
"#Function definition\n",
"def xstrlen(s):\n",
@@ -238,7 +232,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strcpy' function '''\n",
"\n",
"\n",
"#Variable declaration\n",
@@ -278,8 +271,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate a function that\n",
- "copies the contents of one string into another'''\n",
"\n",
"#Function definition\n",
"def xstrcpy (t,s):\n",
@@ -324,7 +315,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strcat' function'''\n",
"\n",
"#Variable declaration\n",
"source = \"Folks!\" \n",
@@ -360,7 +350,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to demonstrate the 'strcmp' function'''\n",
"\n",
"#Variable declaration\n",
"string1 = \"Jerry\\0\" \n",
@@ -414,9 +403,7 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program asks you to type your name. When you do so, it checks your\n",
"name against a master list to see if you are worthy of\n",
- "entry to the palace'''\n",
"\n",
"\n",
"#Function definition\n",
@@ -481,7 +468,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to exchange names using 2-D array of characters'''\n",
"\n",
"#Variable declaration\n",
"names = [\"akshay\\0\\0\\0\",\"parag\\0\\0\\0\\0\",\"raman\\0\\0\\0\\0\",\"srinivas\\0\",\"gopal\\0\\0\\0\\0\",\"rajesh\\0\\0\\0\"]\n",
@@ -524,7 +510,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to exchange names using 2-D array of characters'''\n",
"\n",
"#Variable declaration\n",
"names = [\"akshay\\0\\0\\0\",\"parag\\0\\0\\0\\0\",\"raman\\0\\0\\0\\0\",\"srinivas\\0\",\"gopal\\0\\0\\0\\0\",\"rajesh\\0\\0\\0\"]\n",
@@ -565,8 +550,6 @@ "cell_type": "code",
"collapsed": false,
"input": [
- "'''Program to illustrate the solution to the problem of limitation\n",
- "of Array of Pointers to Strings'''\n",
"\n",
"import copy\n",
"\n",
|