Introduction to Python Programming

Authored Book

The Git repository for the book containing the code examples from the book “Introduction to Python Programming”, authored by Gowrishankar S. and Veena A. and published by CRC Press/Taylor and Francis, Boca Raton, USA can be found here

Book Purchase

You can purchase the book at following sources. (Click on the image to buy)

amazon india

amazon usa


Book Details

Hardcover: 464 pages
Publisher: Chapman and Hall/CRC Press; 1 edition (November 7, 2018)
Language: English
ISBN-10: 0815394373
ISBN-13: 978-0815394372

Software Requirements

All the code in the book works with Python 3.6 version or above. Since f-strings are used throughout the book which was introduced in Python 3.6 version, you need to have Python interpreter 3.6 or above for the code to work as it is. Install the latest version of 64-bit Anaconda Distribution with support for Python 3.6 or above. If you want to make the code work with Python 3.1 to 3.5 versions, use str.format() statements within the print() function instead of f-strings. The rest of the statements within the code remains the same and the code should work fine. It is highly recommended that you use the latest version of PyCharm Community Edition to execute the programs. You will gain valuable insights in to Python programming language by using this IDE, no matter whether you are a beginner or an experienced professional.

Book Source Code

You need to download the folder Book_Code and open it in PyCharm IDE. Each of the code files are numbered and they appear under a Chapter number. The numbering of the code files corresponds to the order in which they appear in the book. Each of the code file is a self-contained file. To run a code file, right-click on the file name in the PyCharm IDE and select the “Run” from the context menu.

Who Should Read This Book?

This book is for beginners to Python programming who are interested in learning the basics of Python programming language.

Citing this Book

You are very welcome to re-use the code snippets for academic purpose; in this case, we would appreciate citations to the original source:

author = {Gowrishankar S., Veena A.},
title = {Introduction to Python Programming},
publisher = {Chapman and Hall/CRC Press},
year = {2018},
address = {Boca Raton, USA},
isbn = {0815394373}

S, Gowrishankar, and A, Veena. Introduction to Python Programming. Chapman & Hall/CRC Press, 2018.

Contributing to the book

Please don’t make pull requests here. I don’t accept pull requests on this repository. If you notice an issue, please file an issue instead.


We hope to improve this book continually. If you have any suggestions for improving this text or if an error should be found, the authors would be grateful if notification were sent by e-mail to [email protected]. To ensure your messages do not end up in our junk mail folder, please include subject as “Introduction to Python Programming.” You can see a list of known issues that have been found in each chapter by looking at Errata and the corresponding corrections. If you have found a mistake and don’t see it listed there, please create a new issue. Thank you for your help!


If you are interested in keeping in touch, I am active on twitter and my id is @g_s_nath.

Table of Contents

1. Introduction
1.1 What Is a Program?
1.2 Programming Languages
1.3 Software Development
1.4 History of Python Programming Language
1.5 Thrust Areas of Python
1.6 Installing Anaconda Python Distribution
1.7 Installing PyCharm IDE to Set Up a Python Development Environment
1.8 Creating and Running Your First Python Project
1.9 Installing and Using Jupyter Notebook
1.10 Open Source Software
1.11 Summary
Multiple Choice Questions
Review Questions
2. Parts of Python Programming Language
2.1 Identifiers
2.2 Keywords
2.3 Statements and Expressions
2.4 Variables
2.5 Operators
2.6 Precedence and Associativity
2.7 Data Types
2.8 Indentation
2.10 Reading Input
2.11 Print Output
2.12 Type Conversions
2.13 The type() Function and Is Operator
2.14 Dynamic and Strongly Typed Language
2.15 Summary
Multiple Choice Questions
Review Questions
3. Control Flow Statements
3.1 The if Decision Control Flow Statement
3.2 The if…else Decision Control Flow Statement
3.3 The if…elif…else Decision Control Statement
3.4 Nested if Statement
3.5 The while Loop
3.6 The for Loop
3.7 The continue and break Statements
3.8 Catching Exceptions Using try and except Statement
3.9 Summary
Multiple Choice Questions
Review Questions
4. Functions
4.1 Built-In Functions
4.2 Commonly Used Modules
4.3 Function Definition and Calling the Function
4.4 The return Statement and void Function
4.5 Scope and Lifetime of Variables
4.6 Default Parameters
4.7 Keyword Arguments
4.8 *args and **kwargs
4.9 Command Line Arguments
4.10 Summary
Multiple Choice Questions
Review Questions
5. Strings
5.1 Creating and Storing Strings
5.2 Basic String Operations
5.3 Accessing Characters in String by Index Number
5.4 String Slicing and Joining
5.5 String Methods
5.6 Formatting Strings
5.7 Summary
Multiple Choice Questions
Review Questions
6. Lists
6.1 Creating Lists
6.2 Basic List Operations
6.3 Indexing and Slicing in Lists
6.4 Built-In Functions Used on Lists
6.5 List Methods
6.6 The del Statement
6.7 Summary
Multiple-Choice Questions
Review Questions
7. Dictionaries
7.1 Creating Dictionary
7.2 Accessing and Modifying key:value Pairs in Dictionaries
7.3 Built-In Functions Used on Dictionaries
7.4 Dictionary Methods
7.5 The del Statement
7.6 Summary
Multiple Choice Questions
Review Questions
8. Tuples and Sets
8.1 Creating Tuples
8.2 Basic Tuple Operations
8.3 Indexing and Slicing in Tuples
8.4 Built-In Functions Used on Tuples
8.5 Relation between Tuples and Lists
8.6 Relation between Tuples and Dictionaries
8.7 Tuple Methods
8.8 Using zip() Function
8.9 Sets
8.10 Set Methods
8.10.1 Traversing of Sets
8.11 Frozenset
8.12 Summary
Multiple Choice Questions
Review Questions
9. Files
9.1 Types of Files
9.2 Creating and Reading Text Data
9.3 File Methods to Read and Write Data
9.4 Reading and Writing Binary Files
9.5 The Pickle Module
9.6 Reading and Writing CSV Files
9.7 Python os and os.path Modules
9.8 Summary
Multiple Choice Questions
Review Questions
10. Regular Expression Operations
10.1 Using Special Characters
10.2 Regular Expression Methods
10.3 Named Groups in Python Regular Expressions
10.4 Regular Expression with glob Module
10.5 Summary
Multiple Choice Questions
Review Questions
11. Object-Oriented Programming
11.1 Classes and Objects
11.2 Creating Classes in Python
11.3 Creating Objects in Python
11.4 The Constructor Method
11.5 Classes with Multiple Objects
11.6 Class Attributes versus Data Attributes
11.7 Encapsulation
11.8 Inheritance
11.9 The Polymorphism
11.10 Summary
Multiple Choice Questions
Review Questions
12. Introduction to Data Science
12.1 Functional Programming
12.2 JSON and XML in Python
12.3 NumPy with Python
12.4 Pandas
12.5 Altair
12.6 Summary
Multiple Choice Questions
Review Questions


comments powered by Disqus