Python
"Python has become the de facto standard for
exploratory, interactive, and computation-driven
scientific research."
Tutorial:
('*' refers to:
The Python Tutorial
)
0. Getting Started:
A "copy" program (files, lists. REs).
1. Introduction:
Loops, conds, output, format, functions.
2. Regular Expressions:
Implemented by the library module
re
.
Includes a systems programming example as 2.6.
3. Containers:
Much commonality, especially the first 3 below.
3.1 Strings:
Like normal strings. (2015 base 2 = palindrome.)
3.2 Lists:
A cross between linked lists and arrays.
3.3 Tuples:
* Like lists but can't be changed after creation.
3.4 Dictionaries:
Called "Associative Arrays" elsewhere.
3.5 Sets:
* Unusual, implements mathematical sets.
4. Randomization:
Python's Random Number Generator.
5. Debugging:
Especially the use of
pdb
.
6. Binary Trees:
Using lists or pointers
6.1 Trees as Lists:
Concordance program.
6.2 Trees Using Pointers:
Concordance program.
6.3 Concordance Programs:
Performance.
8. Classes:
Everything is a class in Python
8.1 Introduction:
Just insert "
self.
" everywhere.
8.2 Examples of Classes:
complex numbers, etc.
9. Case Study: Finite Automata:
Simulating DFAs and NFAs.
9.1 Basic Program:
No classes. Uses Python sets.
9.2 Using a Class:
Not the final word. Uses Python sets.
10. Graphs:
Using adjacency lists.
10.1 Introduction:
Representation.
10.2 Knight's Tour:
Backtracking search.
10.3 US Capitals:
11. Functions:
11.1 Introduction:
Parameters, lambda.
11.2 Decorators & Memoization:
13. Arbitrary-Precision Float:
Library
mpmath
.
13.1 Introduction:
Examples
13.2 Gregory's Series:
Calculate Pi
13.3 Other Number Bases:
Use conversions. See
Article
.
13.4 Iterative Pi:
Uses Arithmetic-geometric Mean
14. Partitions:
Counting partitions of an integer.
(Many topics not yet covered.)
From the Homepage:
www.python.org
Documentation
: Links for Python 2.x and 3.x
Getting Started
: for beginners
Python2orPython3
: differences, and which you should use
Python FAQs
: particularly informative
Popularity:
eval("Python"):
tiobe
,
pypl
Python versus Perl:
Coordinate-wise vector addition
Python in XKCD:
6 cartoons
(
Revision:
2022-12-07
. Use
ISO 8601
, the International Standard.)