"Programming with Python" is both a book and a course held at Hefei University (合肥大学). We here provide all the resources of this course.
The goal of the course and book is to teach undergraduate and graduate students how to program with the Python programming language. The resources may also be suitable to high school students or whoever else may be interested in the topic. Our aim is to strike a good balance between theory and practice, leaning more to the practice side. In particular, we try to teach programming together with some software engineering concepts. It is the firm opinion of the author that these two cannot be separated. Teaching programming alone without introducing tools such as static code analysis, unit tests, and enforcing principles such as code style and proper commenting will create bad programmers. So we discuss these aspects while working our way through the principles of programming.
The website with up-to-date information about the course is https://thomasweise.github.io/programmingWithPython.
The book itself can be downloaded as pdf at https://thomasweise.github.io/programmingWithPython/programmingWithPython.pdf.
Die Slides zum Kurs in deutscher Sprache können unter https://thomasweise.github.io/programmingWithPythonSlidesDE gefunden werden und sind hier aufgelistet:
- Organisation
- Einleitung
- Python Installieren
- PyCharm Installieren
- Programme Erstellen und Ausführen
- Beispiele Herunterladen
- Der Datentyp
int
- Der Datentyp
float
- Zwischenspiel: Python Dokumentation und Informationsquellen
- Der Datentyp
bool
- Der Datentyp
str
None
- Variablen: Wertzuweisung
- Zwischenspiel: Fehler im Kode mit Exceptions und IDE finden
- Variablen: Typen und Type Hints
- Gleichheit und Identität
- Listen
- Zwischenspiel: Der Linter Ruff
- Tupel
- Mengen
- Dictionaries bzw. Hash Maps
- Alternativen mit
if
- Schleifen mit
for
enumerate
und Zwischenspiel: Pylint- Schleifen mit
while
- Funktionen definieren und aufrufen
- Funktionen in Modulen
- Zwischenspiel: Unit Tests
- Funktionsargumente
- Funktionen als Parameter,
Callable
s undlambda
s - Ausnahmen auslösen
- Ausnahmen verarbeiten
- Zwischenspiel: Testen auf Ausnahmen
- Iteration
- List Comprehension
- Zwischenspiel: Doctests
- Set und Dictionary Comprehension
- Generator-Ausdrücke
- Generator-Funktionen
The slides for the course are available at https://thomasweise.github.io/programmingWithPythonSlides and also listed below. Since the course is taught in German language at present, these slides will remain incomplete indefinitely.
Our course offers a lot of examples. You can find all of them in the repository https://github.com/thomasWeise/programmingWithPythonCode.
Both the book and the slides are written in LaTeX. You can find their sources in https://github.com/thomasWeise/programmingWithPython and https://github.com/thomasWeise/programmingWithPythonSlides, respectively. You may use these files under the licensing terms provided below.
This repository contains two types of material: Materials that I (Thomas Weise) have created by myself and such that have been created by others.
The vast majority of the material is teaching material created by me (Thomas Weise). This and only this material is released under the Attribution-NonCommercial-ShareAlike 4.0 International license (CC BY‑NC‑SA 4.0), see http://creativecommons.org/licenses/by-nc-sa/4.0 for a summary.
However, the repository also includes some images and figures created by others, which are marked explicitly and licensed under their authors' terms. For example, all logos and trademarks are under the copyright of their respective owners. The list of files not under the CC BY‑NC‑SA 4.0 license but under their individual owners' copyrights includes, but is not limited to:
- the Python Logo, e.g.,
- text/main/introduction/pythonLogo.pdf
- text/main/introduction/pythonLogo.svg
- all screenshots from websites
- The illustration of LIU Hui (刘徽) in file "text/main/basics/variables/assignment/liu_hui.jpg" is from Wenqi Ying (应雯棋), editor. Commemoration of Ancient Chinese Mathematical Master Liu Hui for his Timeless Influence on Mathematics and Civilizational Exchange. Issue 48 of CAST Newsletter. China, Beijing (中国北京市): 中国科学技术协会 (China Association for Science and Technology, CAST), 2024. Permission was granted to include it in this material, but the copyright remains with CAST.
- The illustration of Hero(n) of Alexandria in file "text/main/controlFlow/loops/heronOfAlexandria.jpg" is taken from the article "The Ancient Greek Who Invented the World's First Steam Turbine", where its caption states Heron of Alexandria. Codex of Saint Gregory Nazianzenos. Greek manuscript of the ninth century. Public Domain.
- The illustration of Euclid of Alexandria in "text/main/controlFlow/functions/euclidOfAlexandria" attributed to the painter Charles Paul Landon (1760-1826). Source:~Vikidia, where it is noted as domaine public, i.e., as in the Public Domain.
- The illustration of Leonardo Pisano / Fibonnaci in file "text/main/controlFlow/iteration/fibonacci.jpg" shows a Sculpture by Bertel Thorvaldsen, 1834/1838 and is sourced from the Thorvaldsens Museum exhibit~A187 photographed by Jakob Faurvig, and is published under the Creative Commons Zero (CC0 license.
You can download its newest version of the course material from https://thomasweise.github.io/databases. This version may change since this course and book both are work in progress. You can cite this book as follows:
@book{programmingWithPython,
author = {Thomas Weise},
title = {Programming with Python},
year = {2024--2025},
publisher = {Institute of Applied Optimization,
School of Artificial Intelligence and Big Data,
Hefei University},
address = {Hefei, Anhui, China},
url = {https://thomasweise.github.io/programmingWithPython}
}
If you have any comments or suggestions regarding the book, or if you spotted an error or typo, please feel free to submit an issue here. Your feedback would help us to improve the book.
We statically include the pdfsizeopt tool in the build process of our book via the bookbase repository and use it during the book compiling and building process to compress the book pdf file. This tool is excluded from the license mentioned above. It is under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991 and the copyright belongs to its authors.
If you have any questions or suggestions, please contact Prof. Dr. Thomas Weise (汤卫思教授) at the Institute of Applied Optimization (应用优化研究所, IAO) of the School of Artificial Intelligence and Big Data (人工智能与大数据学院) of Hefei University (合肥大学), in Hefei, Anhui, China (中国安徽省合肥市) via email to tweise@hfuu.edu.cn with CC to tweise@ustc.edu.cn.