|
| 1 | +# Programming with Python |
| 2 | + |
| 3 | +## 1. Introduction |
| 4 | + |
| 5 | +*"Programming with Python"* is both a book and a course held at [Hefei University](http://www.hfuu.edu.cn/english/) ([合肥大学](http://www.hfuu.edu.cn/)). |
| 6 | +We here provide all the resources of this course. |
| 7 | + |
| 8 | +The goal of the course and book is to teach undergraduate and graduate students how to program with the Python programming language. |
| 9 | +The resources may also be suitable to high school students or whoever else may be interested in the topic. |
| 10 | +Our aim is to strike a good balance between theory and practice, leaning more to the practice side. |
| 11 | +In particular, we try to teach programming together with some software engineering concepts. |
| 12 | +It is the firm opinion of the author that these two cannot be separated. |
| 13 | +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. |
| 14 | +So we discuss these aspects while working our way through the principles of programming. |
| 15 | + |
| 16 | + |
| 17 | +## 2. Resources |
| 18 | +The website with up-to-date information about the course is <https://thomasweise.github.io/programmingWithPython>. |
| 19 | + |
| 20 | + |
| 21 | +### 2.1. The Book |
| 22 | +The book itself can be downloaded as pdf at <https://thomasweise.github.io/programmingWithPython/programmingWithPython.pdf>. |
| 23 | + |
| 24 | + |
| 25 | +### 2.2. Questions and Exercises / Fragen und Übungen |
| 26 | +At <https://thomasweise.github.io/programmingWithPythonQuestions/programmingWithPythonQuestions.pdf>, we provide a list of questions and exercises that you can use to test your knowledge on Python. |
| 27 | +The questions are both in English and German language. |
| 28 | + |
| 29 | +Bei <https://thomasweise.github.io/programmingWithPythonQuestions/programmingWithPythonQuestions.pdf> stellen wir eine Liste von Fragen und Übungen zur Verfügung, die Sie verwenden können, um Ihre Python-Fähigkeiten zu testen. |
| 30 | +Die Fragen sind sowohl in Englisch als auch in Deutsch geschrieben. |
| 31 | + |
| 32 | + |
| 33 | +### 2.3. Die Slides in Deutsch — The Slides in German Language |
| 34 | +Die Slides zum Kurs in deutscher Sprache können unter <https://thomasweise.github.io/programmingWithPythonSlidesDE> gefunden werden und sind hier aufgelistet: |
| 35 | + |
| 36 | +1. [Organisation](https://thomasweise.github.io/programmingWithPythonSlidesDE/01_organisation.pdf) |
| 37 | +2. [Einleitung](https://thomasweise.github.io/programmingWithPythonSlidesDE/02_einleitung.pdf) |
| 38 | +3. [Python Installieren](https://thomasweise.github.io/programmingWithPythonSlidesDE/03_python_installieren.pdf) |
| 39 | +4. [PyCharm Installieren](https://thomasweise.github.io/programmingWithPythonSlidesDE/04_pycharm_installieren.pdf) |
| 40 | +5. [Programme Erstellen und Ausführen](https://thomasweise.github.io/programmingWithPythonSlidesDE/05_programme_erstellen_und_ausführen.pdf) |
| 41 | +6. [Beispiele Herunterladen](https://thomasweise.github.io/programmingWithPythonSlidesDE/06_beispiele_herunterladen.pdf) |
| 42 | +7. [Der Datentyp `int`](https://thomasweise.github.io/programmingWithPythonSlidesDE/07_int.pdf) |
| 43 | +8. [Der Datentyp `float`](https://thomasweise.github.io/programmingWithPythonSlidesDE/08_float.pdf) |
| 44 | +9. [Zwischenspiel: Python Dokumentation und Informationsquellen](https://thomasweise.github.io/programmingWithPythonSlidesDE/09_dokumentation.pdf) |
| 45 | +10. [Der Datentyp `bool`](https://thomasweise.github.io/programmingWithPythonSlidesDE/10_bool.pdf) |
| 46 | +11. [Der Datentyp `str`](https://thomasweise.github.io/programmingWithPythonSlidesDE/11_str.pdf) |
| 47 | +12. [`None`](https://thomasweise.github.io/programmingWithPythonSlidesDE/12_none.pdf) |
| 48 | +13. [Variablen: Wertzuweisung](https://thomasweise.github.io/programmingWithPythonSlidesDE/13_variablen_wertzuweisung.pdf) |
| 49 | +14. [Zwischenspiel: Fehler im Kode mit Exceptions und IDE finden](https://thomasweise.github.io/programmingWithPythonSlidesDE/14_fehler_im_kode_mit_exceptions_und_ide_finden.pdf) |
| 50 | +15. [Variablen: Typen und Type Hints](https://thomasweise.github.io/programmingWithPythonSlidesDE/15_variablen_typen_und_type_hints.pdf) |
| 51 | +16. [Gleichheit und Identität](https://thomasweise.github.io/programmingWithPythonSlidesDE/16_gleichheit_und_identität.pdf) |
| 52 | +17. [Listen](https://thomasweise.github.io/programmingWithPythonSlidesDE/17_listen.pdf) |
| 53 | +18. [Zwischenspiel: Der Linter Ruff](https://thomasweise.github.io/programmingWithPythonSlidesDE/18_ruff.pdf) |
| 54 | +19. [Tupel](https://thomasweise.github.io/programmingWithPythonSlidesDE/19_tupel.pdf) |
| 55 | +20. [Mengen](https://thomasweise.github.io/programmingWithPythonSlidesDE/20_mengen.pdf) |
| 56 | +21. [Dictionaries bzw. Hash Maps](https://thomasweise.github.io/programmingWithPythonSlidesDE/21_dictionaries.pdf) |
| 57 | +22. [Alternativen mit `if`](https://thomasweise.github.io/programmingWithPythonSlidesDE/22_alternativen_mit_if.pdf) |
| 58 | +23. [Schleifen mit `for`](https://thomasweise.github.io/programmingWithPythonSlidesDE/23_schleifen_mit_for.pdf) |
| 59 | +24. [`enumerate` und Zwischenspiel: Pylint](https://thomasweise.github.io/programmingWithPythonSlidesDE/24_enumerate_und_pylint.pdf) |
| 60 | +25. [Schleifen mit `while`](https://thomasweise.github.io/programmingWithPythonSlidesDE/25_schleifen_mit_while.pdf) |
| 61 | +26. [Funktionen definieren und aufrufen](https://thomasweise.github.io/programmingWithPythonSlidesDE/26_funktionen_definieren_und_aufrufen.pdf) |
| 62 | +27. [Funktionen in Modulen](https://thomasweise.github.io/programmingWithPythonSlidesDE/27_funktionen_in_modulen.pdf) |
| 63 | +28. [Zwischenspiel: Unit Tests](https://thomasweise.github.io/programmingWithPythonSlidesDE/28_unit_tests.pdf) |
| 64 | +29. [Funktionsargumente](https://thomasweise.github.io/programmingWithPythonSlidesDE/29_funktionsargumente.pdf) |
| 65 | +30. [Funktionen als Parameter, `Callable`s und `lambda`s](https://thomasweise.github.io/programmingWithPythonSlidesDE/30_callables_und_lambdas.pdf) |
| 66 | +31. [Ausnahmen auslösen](https://thomasweise.github.io/programmingWithPythonSlidesDE/31_ausnahmen_auslösen.pdf) |
| 67 | +32. [Ausnahmen verarbeiten](https://thomasweise.github.io/programmingWithPythonSlidesDE/32_ausnahmen_verarbeiten.pdf) |
| 68 | +33. [Zwischenspiel: Testen auf Ausnahmen](https://thomasweise.github.io/programmingWithPythonSlidesDE/33_testen_auf_ausnahmen.pdf) |
| 69 | +34. [Iteration](https://thomasweise.github.io/programmingWithPythonSlidesDE/34_iteration.pdf) |
| 70 | +35. [List Comprehension](https://thomasweise.github.io/programmingWithPythonSlidesDE/35_list_comprehension.pdf) |
| 71 | +36. [Zwischenspiel: Doctests](https://thomasweise.github.io/programmingWithPythonSlidesDE/36_doctests.pdf) |
| 72 | +37. [Set und Dictionary Comprehension](https://thomasweise.github.io/programmingWithPythonSlidesDE/37_set_und_dictionary_comprehension.pdf) |
| 73 | +38. [Generator-Ausdrücke](https://thomasweise.github.io/programmingWithPythonSlidesDE/38_generator_ausdrücke.pdf) |
| 74 | +39. [Generator-Funktionen](https://thomasweise.github.io/programmingWithPythonSlidesDE/39_generator_funktionen.pdf) |
| 75 | +40. [Operationen für Iteratoren](https://thomasweise.github.io/programmingWithPythonSlidesDE2/40_operationen_für_iteratoren.pdf) |
| 76 | +41. [Klassen: Grundlagen](https://thomasweise.github.io/programmingWithPythonSlidesDE2/41_klassen_grundlagen.pdf) |
| 77 | +42. [Klassen: Kapselung](https://thomasweise.github.io/programmingWithPythonSlidesDE2/42_klassen_kapselung.pdf) |
| 78 | +43. [Klassen: Vererbung](https://thomasweise.github.io/programmingWithPythonSlidesDE2/43_klassen_vererbung.pdf) |
| 79 | +44. [Klassen/Dunder: `__str__`, `__repr__`, und `__eq__`](https://thomasweise.github.io/programmingWithPythonSlidesDE2/44_klassen_dunder_str_rep_eq.pdf) |
| 80 | +45. [Klassen/Dunder: `__hash__`](https://thomasweise.github.io/programmingWithPythonSlidesDE2/45_klassen_dunder_hash.pdf) |
| 81 | +46. [Klassen/Dunder: Arithmetische Operatoren und Vergleiche](https://thomasweise.github.io/programmingWithPythonSlidesDE2/46_klassen_dunder_math.pdf) |
| 82 | +47. [Zwischenspiel: Debugger](https://thomasweise.github.io/programmingWithPythonSlidesDE2/47_debugger.pdf) |
| 83 | + |
| 84 | + |
| 85 | +### 2.4. Complete Packages / Komplettpaket |
| 86 | + |
| 87 | +The following complete packages are available: |
| 88 | + |
| 89 | +- [`2025.11.17`](https://github.com/thomasWeise/programmingWithPython/releases/download/2025.11.17/programmingWithPython_2025_11_17.tar.xz) provides the end state of the book, slides (in German), questions, and example sources after the lecture period in Winter Semester 2025 at Hefei University (合肥大学). |
| 90 | + |
| 91 | + |
| 92 | +### 2.5. The Slides in English |
| 93 | +The slides for the course are available at <https://thomasweise.github.io/programmingWithPythonSlides> and also listed below. |
| 94 | +Since the course is taught in German language at present, these slides will remain incomplete indefinitely. |
| 95 | + |
| 96 | +1. [Introduction](https://thomasweise.github.io/programmingWithPythonSlides/01_introduction.pdf) |
| 97 | +2. [Getting Started](https://thomasweise.github.io/programmingWithPythonSlides/02_getting_started.pdf) |
| 98 | + |
| 99 | +### 2.5. The Example Python Programs |
| 100 | +Our course offers a lot of examples. |
| 101 | +You can find all of them in the repository <https://github.com/thomasWeise/programmingWithPythonCode>. |
| 102 | + |
| 103 | + |
| 104 | +### 2.6. LaTeX Sources, Graphics, Bibliography, etc. |
| 105 | +Both the book and the slides are written in LaTeX. |
| 106 | +You can find their sources in <https://github.com/thomasWeise/programmingWithPython> and <https://github.com/thomasWeise/programmingWithPythonSlides>, respectively. |
| 107 | +You may use these files under the licensing terms provided below. |
| 108 | + |
| 109 | + |
| 110 | +## 3. License |
| 111 | +This repository contains two types of material: |
| 112 | +Materials that I (Thomas Weise) have created by myself and such that have been created by others. |
| 113 | + |
| 114 | +The vast majority of the material is teaching material created by me (Thomas Weise). |
| 115 | +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](http://creativecommons.org/licenses/by-nc-sa/4.0/) for a summary. |
| 116 | + |
| 117 | +However, the repository also includes some images and figures created by others, which are marked explicitly and licensed under their authors' terms. |
| 118 | +For example, all logos and trademarks are under the copyright of their respective owners. |
| 119 | +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: |
| 120 | + |
| 121 | ++ the [Python](https://www.python.org) Logo, e.g., |
| 122 | + - text/main/introduction/pythonLogo.pdf |
| 123 | + - text/main/introduction/pythonLogo.svg |
| 124 | ++ all screenshots from websites |
| 125 | ++ 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](https://english.cast.org.cn/cms_files/filemanager/1941250207/attach/202412/8f23655a82364d19ad7874eb37b23035.pdf). 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. |
| 126 | ++ 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](https://greekreporter.com/2023/12/13/ancient-greek-world-first-steam-turbine)", where its caption states *Heron of Alexandria. Codex of Saint Gregory Nazianzenos. Greek manuscript of the ninth century. Public Domain*. |
| 127 | ++ The illustration of Euclid of Alexandria in "text/main/controlFlow/functions/euclidOfAlexandria" [attributed](https://www.antike-griechische.de/Euklid.pdf) to the painter Charles Paul Landon (1760-1826). Source:~[Vikidia](https://fr.vikidia.org/wiki/Cat%C3%A9gorie:Image_Euclide), where it is noted as *domaine public,* i.e., as in the Public Domain. |
| 128 | ++ 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](https://kataloget.thorvaldsensmuseum.dk/A187) photographed by Jakob Faurvig, and is published under the Creative Commons Zero ([CC0](https://creativecommons.org/publicdomain/zero/1.0)) license. |
| 129 | + |
| 130 | +You can download its newest version of the course material from <https://thomasweise.github.io/programmingWithPython>. |
| 131 | +This version may change since this course and book both are work in progress. |
| 132 | +You can cite this book as follows: |
| 133 | + |
| 134 | +<pre>@book{programmingWithPython,<br/> author = {Thomas Weise},<br/> title = {Programming with Python},<br/> year = {2024--2025},<br/> publisher = {Institute of Applied Optimization,<br/> <a href="http://www.hfuu.edu.cn/aibd">School of Artificial Intelligence and Big Data</a>,<br/> <a href="http://www.hfuu.edu.cn/">Hefei University</a>},<br/> address = {Hefei, Anhui, China},<br/> url = {<a href="https://thomasweise.github.io/programmingWithPython">https://thomasweise.github.io/programmingWithPython</a>}<br/>}</pre> |
| 135 | + |
| 136 | +**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](https://github.com/thomasWeise/programmingWithPython/issues).** |
| 137 | +Your feedback would help us to improve the book. |
| 138 | + |
| 139 | +We statically include the [pdfsizeopt](https://github.com/pts/pdfsizeopt) tool in the build process of our book via the [bookbase repository](https://github.com/thomasWeise/bookbase) and use it during the book compiling and building process to compress the book pdf file. |
| 140 | +This tool is excluded from the license mentioned above. |
| 141 | +It is under the GNU GENERAL PUBLIC LICENSE Version 2, June 1991 and the copyright belongs to its authors. |
| 142 | + |
| 143 | + |
| 144 | +## 4. Contact |
| 145 | +If you have any questions or suggestions, please contact |
| 146 | +Prof. Dr. Thomas Weise (汤卫思教授) |
| 147 | +at the Institute of Applied Optimization (应用优化研究所, IAO) |
| 148 | +of the School of Artificial Intelligence and Big Data ([人工智能与大数据学院](http://www.hfuu.edu.cn/aibd)) |
| 149 | +of [Hefei University](http://www.hfuu.edu.cn/english/) ([合肥大学](http://www.hfuu.edu.cn/)), |
| 150 | +in Hefei, Anhui, China (中国安徽省合肥市) |
| 151 | + |
0 commit comments