Introduction to Python Programming. Preface
Introduction to Python Programming
Dr. Pavel Solin
About the Author
Dr. Pavel Solin is Professor of Applied and Computational Mathematics at the
University of Nevada, Reno. He is an expert in scientific computing, leader of open
source projects, organizer of international scientific congresses, and the author of
several textbooks, research monographs, and many research articles in international
journals.
Acknowledgment
Our sincere thanks go to many educators and students for providing valuable feedback
on this textbook as well as on the self-paced Python I and Python II courses in
NCLab.
Copyright:
Copyright (c) 2018 NCLab Inc. All Rights Reserved.
Preface
Python is a modern high-level dynamic programming language which is widely used in business, science, and engineering applications. According to Github, as of 2018 Python is the second most popular programming language after Javascript. Python’s growing popularity has the following reasons:
- It is known as a beginner’s language because of its simplicity.
- It helps developers to be more productive from development to deployment and maintenance.
Python’s syntax is very simple and high level when compared to Java, C and C++. Therefore,
applications can be built with less code. Last, Python has a large collection of powerful
libraries.
Python libraries
Thanks to its free libraries, Python is replacing traditional software products in many areas.
In data analysis and statistics, Python has become more popular than SAS and even than R.
In scientific computing and visualization, the collection of the libraries Scipy, Numpy, Sympy,
Matplotlib and Mayavi has become more popular than MATLAB. Python also has powerful
libraries for machine learning (Tensorflow, Keras), for graph theory (NetworkX), and many
others.
How to read this textbook
In contrast to other languages, Python can be used by non-programmers. Therefore, as the first thing we will show you how to use Python as a powerful command-line scientific calculator and data visualization tool.
Starting with Section 4 we will explore Python as a programming language. We will show you how to work with text strings, variables, tuples, lists, dictionaries, functions, loops, conditions, files, exceptions, recursion, object-oriented programming, recursion, decorators, and more.
In every section, we will begin with simple examples and gradually progress to advanced
applications. Therefore, you don’t need to read every section until the end. It’s perfectly fine
to read the first part of a section, move on, and return to the advanced topics later.
Enjoy the textbook, and contact me at pavel@nclab.com if you have any questions, find
typos, or have suggestions for other topics you would like to see here. Many thanks! –
Pavel
Table of Contents
- Preface
- 1. Introduction
- 2. Using Python as a Scientific Calculator
- 3. Drawing, Plotting, and Data Visualization with Matplotlib
- 4. Working with Text Strings
- 5. Variables and Types
- 6. Boolean Values, Functions, Expressions, and Variables
- 7. Lists, Tuples, Dictionaries, and Sets
- 8. Functions
- 9. The ’For’ Loop
- 10. Conditions
- 11. The ’While’ Loop
- 12. Exceptions
- 13. File Operations
- 14. Object-Oriented Programming I – Introduction
- 15. Object-Oriented Programming II – Class Inheritance
- 16. Object-Oriented Programming III – Advanced Aspects
- 17. Recursion
- 18. Decorators
- 19. Selected Advanced Topics