Detailed ContentsPreface vBrief Contents viii1 Introduction to Computers andProblem Solving Strategies1.1 Introduction 11.2 What is a Computer? 11.3 History of Computers 21.4 Characteristics of Computers 41.5 Classification of Computers 51.6 Basic Applications ofComputers 91.7 Stored Program Concept 111.
7.1 Types of Stored ProgramComputers 121.8 Components and Functions of aComputer System 121.9 Concept of Hardware andSoftware 141.9.1 Hardware 141.9.2 Software 141.
10 Central Processing Unit (CPU): BasicArchitecture 141.11 Input and Output Devices 161.12 Computer Memory 171.12.1 Memory Hierarchy 181.12.2 Primary Memory 181.12.
3 Secondary Storage Devices 201.13 Classification of ComputerSoftware 201.13.1 System Software 221.13.2 Application Software 271.14 Representation of Data: Bits andBytes 291.15 Problem Solving Strategies 311.
15.1 Fundamentals of Computing -Identification of ComputationalProblems 321.16 Program Design Tools: Algorithms,Flowcharts, Pseudocodes 331.16.1 Algorithms 331.16.2 Flowcharts 381.16.
3 Pseudocodes 401.17 Types of Errors 421.18 Testing and DebuggingApproaches 432 Introduction to Object OrientedProgramming (OOP)2.1 Computer Programming andProgramming Languages 532.2 Generations of ProgrammingLanguages 542.2.1 First Generation: MachineLanguage 542.2.
2 Second Generation: AssemblyLanguage 552.2.3 Third Generation: High-levelLanguage 562.2.4 Fourth Generation: VeryHigh-level Languages 572.2.5 Fifth Generation ProgrammingLanguage 582.3 Programming Paradigms 592.
3.1 Monolithic Programming 592.3.2 Procedural Programming 592.3.3 Structured Programming 602.3.4 Object Oriented Programming(OOP) 612.
4 Features of Object OrientedProgramming 622.4.1 Classes 622.4.2 Objects 632.4.3 Method and Message Passing2.4.
4 Inheritance 642.4.5 Polymorphism 652.4.6 Containership 652.4.7 Reusability 652.4.
8 Delegation 662.4.9 Data Abstraction andEncapsulation 662.5 Merits and Demerits of ObjectOriented Programming Language 67Detailed Contents4 Decision Control Statements2.6 Applications of Object OrientedProgramming 672.7 Differences Between PopularProgramming Languages 683 Basics of Python Programming3.1 Features of Python 733.2 History of Python 753.
3 The Future of Python 773.4 Writing and Executing First PythonProgram 773.4.1 Internal Working of Python 783.4.2 Python Tokens 793.5 Literal Constants 793.5.
1 Numbers 793.5.2 Strings 813.5.3 Slice a String 853.6 Variables and Identifiers 863.7 Data Types of Identifiers 873.8 Input Operation 883.
9 Comments 883.10 Reserved Words 893.11 Indentation 893.12 Operators and Expressions 903.12.1 Arithmetic Operators 903.12.2 Comparison Operators 903.
12.3 Assignment and In-place orShortcut Operators 913.12.4 Unary Operators 923.12.5 Bitwise Operators 923.12.6 Shift Operators 933.
12.7 Logical Operators 943.12.8 Membership Operators 953.12.9 Identity Operators 953.12.10 Operators Precedence andAssociativity 953.
13 Expressions in Python 963.14 Operations on Strings 973.14.1 Concatenation 973.14.2 Multiplication (or StringRepetition) 983.15 Other Data Types 993.15.
1 Tuples 993.15.2 Lists 993.15.3 Dictionary 1003.16 Type Conversion 1004.1 Introduction to Decision ControlStatements 1154.2 Selection/Conditional BranchingStatements 1164.
2.1 if Statement 1164.2.2 if-else Statement 1174.2.3 Nested if Statements 1204.2.4 if-elif-else Statement 1204.
3 Basic Loop Structures/IterativeStatements 1254.3.1 while Loop 1254.3.2 for Loop 1334.3.3 Selecting an AppropriateLoop 1344.4 Nested Loops 1424.
5 The break Statement 1454.6 The continue Statement 1464.7 The pass Statement 1494.8 The else Statement used withLoops 150Case Study 1 - Simple Calculator 158Case Study 2 - Generating aCalendar 1615 Functions and Modules5.1 Introduction 1635.1.1 Need for Functions 1645.2 Function Definition 1655.
3 Function Call 1675.3.1 Function Parameters 1675.4 Variable Scope and Lifetime 1695.4.1 Local and Global Variables 1705.4.2 Using the Global Statement 1715.
4.3 Resolution of Names 1735.5 The return Statement 1745.6 Fruitful Functions 1765.6.1 The return Statement 1765.6.2 Parameters 1785.
7 Lambda Functions or AnonymousFunctions 1815.8 Function Composition in Python 1855.9 Documentation Strings 1855.10 Good Programming Practices 1865.11 Recursive Functions 192Detailed Contents5.11.1 Greatest Common Divisor 1945.11.
2 Finding Exponents 1955.11.3 The Fibonacci Series 1955.11.4 Tail Recursion 1975.11.5 Recursion vs Iteration 1985.12 Modules 1995.
12.1 The fromELimport Statement 2005.12.2 Name of Module 2025.12.3 Making Your Own Modules 2025.12.4 The dir() Function 2045.
12.5 The Python Module 2055.12.6 Modules and Namespaces 2055.13 Packages in Python 2075.14 Standard Library Modules 2085.15 Globals(), Locals(), andReload() 2095.16 Function Redefinition 210Case Study 3 - Tower of Hanoi 219Case Study 4 - Shuffling a Deck ofCards 2216 Python Strings Revisited6.
13.1 Character Classes 2566.13.2 Groups 2586.13.3 Application of Regular Expressionto Extract Email 2607 File Handling7.1 Introduction 2717.2 File Path 2717.
3 Types of Files 2727.4 Opening and Closing Files 2747.4.1 The open() Function 2747.4.2 The File Object Attributes 2757.4.3 The close() Method 2767.
5 Reading and Writing Files 2776.4.1 Additional String FormattingOperator Examples 2296.5 Built-in String Methods andFunctions 2306.6 Slice Operation 2356.6.1 Specifying Stride While SlicingStrings 2376.12.
1 The match() Function 2496.12.2 The search() Function 2506.12.3 The sub() Function 2516.12.4 The findall() and finditer()Functions 2516.12.
5 Flag Options 2526.13 Metacharacters in RegularExpression 2547.3.1 ASCII Text Files 2737.3.2 Binary Files 2736.1 Introduction 2226.2 Concatenating, Appending, andMultiplying Strings 2236.
3 Strings are Immutable 2256.4 String Formatting Operator 2266.7 ord() and chr() Functions 2386.8 in and not in Operators 2386.9 Comparing Strings 2396.10 Iterating String 2406.11 The String Module 2466.12 Regular Expressions 2496.
12.6 Using Verbose in RegularExpression 2537.5.1 write() and writelines()Methods 2777.5.2 append() Method 2777.5.3 The read() and readline()Methods 2787.
5.4 Opening Files using withKeyword 2807.5.5 Splitting Words 2817.5.6 Opening Files using CommandLine Arguments 2827.5.7 Some Other Useful FileMethods 2827.
6 File Positions 2837.6.1 Seek a Position in a File 2847.7 Renaming and Deleting Files 2867.8 Directory Methods 2877.8.1 Methods from the osModule 2907.8.
2 Get File Permissions 2967.8.3 Set File Permissions(CHMOD) 2967.8.4 Change Ownership(CHOWN) 2977.8.5 Get File Timestamp 2977.8.
6 Set File Timestamp 2987.8.7 Symlink 298Detailed ContentsCase Study 5 - Creating a Hash File (or amessage digest of a file) 305Case Study 6 - Mail Merge Program 307Case Study 7 - Finding Resolution of anImage 3098 Data Structures8.1 Sequence 3108.2 Lists 3108.2.1 Access Values in Lists 3118.2.
2 Updating Values in Lists 3118.2.3 Nested Lists 3138.2.4 Cloning Lists 3148.2.5 Basic List Operations 3148.2.
6 List Aliasing 3158.2.7 List Cloning 3168.2.8 List Methods 3168.2.9 Using Lists as Stack 3198.2.
10 Using Lists as Queues 3208.2.11 List Comprehensions 3218.2.12 Looping in Lists 3238.3 Functional Programming 3258.3.1 filter() Function 3258.
3.2 map() Function 3268.3.3 reduce() Function 3278.4 Tuple 3368.4.1 Creating Tuple 3368.4.
2 Utility of Tuples 3388.4.3 Accessing Values in a Tuple 3388.3.4 Updating Tuple 3398.4.5 Deleting Elements in Tuple 3398.4.
6 Basic Tuple Operations 3408.4.7 Tuple Assignment 3408.4.8 Tuples for Returning MultipleValues 3418.4.9 Nested Tuples 3428.4.
10 Checking the Index: index()Method 3428.4.11 Counting the Elements: count()Method 3438.4.12 List Comprehension andTuples 3438.4.13 Variable-length ArgumentTuples 3448.4.
14 The zip() Function 3458.4.15 Advantages of Tuple overList 3478.5 Sets 3508.5.1 Creating a Set 3508.5.2 Set Comprehensions 3588.
6 Dictionaries 3598.6.1 Creating a Dictionary 3608.6.2 Accessing Values 3618.6.3 Adding and Modifying an Item in a Dictionary 3628.6.
4 Modifying an Entry 3628.6.5 Deleting Items 3638.6.6 Sorting Items in a Dictionary 3668.6.7 Looping over a Dictionary 3668.6.
8 Nested Dictionaries 3668.6.9 Built-in Dictionary Functions and Methods 3678.6.10 Difference Between a List and a Dictionary 3698.6.11 String Formatting with Dictionaries 3708.6.
12 When to use which Data Structure? 3708.6.13 List vs Tuple vs Dictionary vs Set 3709 Classes and Objects9.1 Introduction 3859.2 Classes and Objects 3859.2.1 Defining Classes 3859.2.
2 Creating Objects 3869.2.3 Data Abstraction and Hidingthrough Classes 3869.3 Class Method and selfArgument 3879.4 The __init__() Method (The ClassConstructor) 3889.5 Class Variables and ObjectVariables 3889.6 The __del__() Method 3919.7 Other Special Methods 3929.
8 Public and Private DataMembers 3939.9 Private Methods 3949.10 Calling a Class Method from AnotherClass Method 395Detailed Contents9.11 Built-in Functions to Check, Get, Set,and Delete Class Attributes 3979.12 Built-in Class Attributes 3989.13 Garbage Collection (DestroyingObjects) 3999.14 Class Methods 4109.15 Static Methods 41110 Inheritance10.
1 Introduction 41710.2 Inheriting Classes in Python 41810.2.1 Polymorphism and MethodOverriding 41910.3 Types of Inheritance 42210.3.1 Multiple Inheritance 42210.3.
2 Multi-level Inheritance 42310.3.3 Multi-path Inheritance 42410.4 Composition or Containership orComplex Objects 42510.5 Abstract Classes and Interfaces 42710.6 Metaclass 42811 Operator Overloading11.1 Introduction 44111.1.
1 Concept of OperatorOverloading 44111.1.2 Advantage of OperatorOverloading 44211.2 Implementing OperatorOverloading 44211.3 Reverse Adding 45111.4 Overriding __getitem__() and__setitem__() Methods 45211.5 Overriding the in Operator 45311.6 Overloading MiscellaneousFunctions 45411.
7 Overriding the __call__()Method 45512 Error and Exception Handling12.1 Introduction to Errors andExceptions 46112.1.1 Syntax Errors 46112.1.2 Logic Error 46212.1.3 Exceptions 46212.
2 Handling Exceptions 46312.3 Multiple Except Blocks 46412.4 Multiple Exceptions in a SingleBlock 46512.5 Except Block w.