Programming and Problem Solving With Python 1St Edition - Ebook PDF Download
Programming and Problem Solving With Python 1St Edition - Ebook PDF Download
https://ebookluna.com/download/programming-and-problem-solving-
with-python-ebook-pdf/
https://ebookluna.com/download/problem-solving-and-python-programming-
ebook-pdf/
https://ebookluna.com/product/ebook-pdf-programming-problem-solving-and-
abstraction-with-c/
https://ebookluna.com/download/programming-for-problem-solving-ebook-pdf/
https://ebookluna.com/product/ebook-pdf-introduction-to-programming-with-
java-a-problem-solving-approach-3rd-edition/
(eBook PDF) Java: An Introduction to Problem Solving and Programming 7th
Edition
https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-problem-
solving-and-programming-7th-edition/
https://ebookluna.com/product/ebook-pdf-java-an-introduction-to-problem-
solving-and-programming-8th-edition/
https://ebookluna.com/product/ebook-pdf-problem-solving-with-c-10th-
edition/
https://ebookluna.com/product/ebook-pdf-problem-solving-with-c-9th-edition/
https://ebookluna.com/product/ebook-pdf-matlab-a-practical-introduction-to-
programming-and-problem-solving-4th-edition/
PROGRAMMING AND PROBLEM SOLVING
WITH
PYTHON
About the Authors
PYTHON
Ashok Namdev Kamthane
Retired Associate Professor
Department of Electronics and Telecommunication Engineering
Shri Guru Gobind Singhji Institute of Engineering and Technology, Nanded
Maharashtra, India
1 2 3 4 5 6 7 8 9 D103074 22 21 20 19 18
Printed and bound in India.
Print Edition
ISBN (13): 978-93-87067-57-8
ISBN (10): 93-87067-57-2
e-Book Edition
ISBN (13): 978-93-87067-58-5
ISBN (10): 93-87067-58-0
Managing Director: Kaushik Bellani
Director—Science & Engineering Portfolio: Vibha Mahajan
Senior Portfolio Manager—Science & Engineering: Hemant K Jha
Associate Portfolio Manager—Science & Engineering: Mohammad Salman Khurshid
Senior Manager—Content Development: Shalini Jha
Content Developer: Ranjana Chaube
Production Head: Satinder S Baveja
Assistant Manager—Production: Jagriti Kundu
General Manager—Production: Rajender P Ghansela
Manager—Production: Reji Kumar
Information contained in this work has been obtained by McGraw Hill Education (India), from sources believed to be reliable.
However, neither McGraw Hill Education (India) nor its authors guarantee the accuracy or completeness of any information
published herein, and neither McGraw Hill Education (India) nor its authors shall be responsible for any errors, omissions, or
damages arising out of use of this information. This work is published with the understanding that McGraw Hill Education
(India) and its authors are supplying information but are not attempting to render engineering or other professional services. If
such services are required, the assistance of an appropriate professional should be sought.
Typeset at APS Compugraphics, 4G, PKT 2, Mayur Vihar Phase-III, Delhi 96, and printed at
Cover Printer:
It gives us immense pleasure to bring the book ‘Programming and Problem Solving with Python’. The
book is intended for the students in initial years of engineering and mathematics who can use this
high-level programming language as an effective tool in mathematical problem solving. Python is
used to develop applications of any stream and it is not restricted only to computer science.
We believe that anyone who has basic knowledge of computer and ability of logical thinking can
learn programming. With this motivation, we have written this book in a lucid manner. Once you
go through the book, you will know how simple the programming language is and at the same
time you will learn the basics of python programming. You will feel motivated enough to develop
applications using python.
Since this book has been written with consideration that reader has no prior knowledge of
python programming, before going through all the chapters, reader should know what are the
benefits of learning python programming. Following are some of the reasons why one should
learn python language.
• Python language is simple and easy to learn. For example, it has simple syntax compared to
other programming languages.
• Python is an object-oriented programming language. It is used to develop desktop, standalone
and scripting applications.
• Python is also an example of free open source software. Due to its open nature one can write
programs and can deploy on any of platform, i.e., (Windows, Linux, Ubuntu and Mac OS),
without changing the original program.
Thus, due to the features enlisted above, python has become the most popular language and is
widely used among programmers.
• To develop GUI-based applications, cryptography and network security and many more
applications
Electronics and Telecommunication Engineering and Electrical Engineering
• Image processing applications can be developed by using python’s ‘scikit-image’ library
• Widely used in developing embedded applications
• Develop IOT applications using Arduino and Raspberry pi
Python can also be used in other engineering streams such as mechanical, chemical, and
bioinformatics to perform complex calculations by making use of numpy, scipy, and pandas library.
Thus, the end user of this book can be anyone who wants to learn basics of python programming.
To learn the basics, the student can be of any stream/any engineering/Diploma/BCA/MCA
background and interested to develop applications using python.
In the end, we would like to express gratitude to all our well-wishers and readers, whose
unstinted support and encouragement has kept us going as a teacher and author of this book. Any
suggestion regarding the improvement of the book will be highly appreciated.
Publisher’s Note
McGraw-Hill Education (India) invites suggestions and comments from you, all of which can be
sent to [email protected] (kindly mention the title and author name in the subject line).
Piracy-related issues may also be reported.
Visual W
All chapters within the book have been structured into the following important pedagogical
components:
Decision Statements
• Learning Outcomes give a clear idea to the 4
students and programmers on what they will
learn in each chapter. After completion of 4.1 Introduction
CHAPTER OUTLINE
4.6 Boolean Expressions and Relational
4.2 Boolean Type Operators
chapter, they will able to comprehend and apply 4.3
4.4
Boolean Operators
Using Numbers with Boolean Operators
4.7 Decision Making Statements
4.8 Conditional Expressions
all the objectives of the chapter. 4.5 Using String with Boolean Operators
LEARNING OUTCOMES
• Introduction explains the basics of each topic After completing this chapter, students will be able to:
bool
and familiarizes the reader to the concept being Boolean Relational > <,>= <= !=
if
dealt with. if
if else
if-elif-else
conditional expressions
4.1 INTRODUCTION
Write a program to create a list with elements 1,2,3,4 and 5. Display even elements of the list
PROGRAM 8.1 using list comprehension.
List1=[1,2,3,4,5]
print(“Content of List1”)
print(List1)
List1=[x for x in List1 if x%2==0]
print(“Even elements from the List1”)
print(List1)
• Programs are the highlighting
Output Generate 50 random numbers within a range 500 to 1000 and write them to file
feature of the chapters. Ample
PROGRAM 13.3
Content of List1
[1, 2, 3, 4, 5]
WriteNumRandom.txt.
Output File
Visual Walkthrough xi
penup(), pendown(),
forward(), right(), goto(), color(), shape(), speed() left()
Note: The del operator uses index to access the elements of a list. It gives a run time error if the index
• Notes have been inserted in each chapter
is out of range.
Example: to provide valuable insights based on
>>> del Lst[4]
Traceback (most recent call last):
programming concepts. Notes shall
File “<pyshell#37>”, line 1, in <module>
del Lst[4]
also act as precautionary statements for
IndexError: list assignment index out of range readers to solve programming problems
effectively.
SUMMARY
• A concise Summary has been listed at
chapter-end to reiterate vital points and
describes in short, the complex concepts
covered within the chapter.
x = 10
def f():
x= x + 10
print(x)
f()
Acknowledgements
We would like to express deep sense of gratitude to Professor B. M. Naik, former Principal of
S. G. G. S. College of Engineering and Technology, Nanded, who constantly praised and inspired
us to write books on technical subjects and whose enthusiasm and guidance led us to write this
book.
Special thanks are also due to Dr. L. M. Waghmare, Director, S. G. G. S. Institute of Engineering
and Technology, Professor Dr. U. V. Kulkarni, HOD, CSE and Professor P. S. Nalawade of S. G. G. S.
Institute of Engineering and Technology Nanded for encouraging us to write this book on Python.
We are grateful to Professor Dr. Mrs. S. A. Itkar, HOD, CSE and Professor Mrs. Deipali V. Gore
of P. E. S. Modern College of Engineering Pune, for supporting us while writing the book. We
are also thankful to the staff members (Santosh Nagargoje, Nilesh Deshmukh, Kunnal Khadake,
Digvijay Patil and Sujeet Deshpande) of P. E. S. Modern College of Engineering for their valuable
suggestions.
Furthermore, we would like to thank our friends—ShriKumar P. Ugale and Navneet Agrawal—
for giving valuable inputs while writing the book. Also, we would like to thank our students—
Suraj K, Pranav C, and Prajyot Gurav—who offered comments, suggestions and praise while
writing the book.
We are thankful to the following reviewers for providing useful feedback and critical suggestions
during the development of the manuscript.
Lastly, we are indebted to our family members—Mrs. Surekha Kamthane (mother of Amit
Kamthane), Amol, Swarupa, Aditya, Santosh Chidrawar, Sangita Chidrawar, Sakshi and Sartak for
their love, support and encouragement.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookluna.com