Programmierung Grundlagen, anhand von Python (2022-01-17 - 2022-01-10)¶
Überblick¶
Die Kurssprache des Kurses “Programmierung Grundlagen” ist Python; viele der Python-spezifische Elemente werden von hier unterrichtet.
Jupyter Notebook¶
Log¶
Tag 1¶
Variablen und Datentypen¶
-
Indentation: indentation.py
-
Overflow in C: overflow.c
-
Encoding:
Liebe Grüße, Jörg
in UTF-8 umlaut-utf8.txtEncoding:
Liebe Grüße, Jörg
in ISO-8859-1 umlaut-iso-latin-1.txt
-
Swap: swap.py
Swap, Pythonic version: swap-pythonic.py
Kontrollstrukturen¶
Exercise: Determine Maximum of Two Numbers
Maximum: maximum.py
Maximum, Pythonic version maximum-pythonic.py
Tag 2¶
Exercise: Even Numbers (while)
Straightforward (
while
): even.pyStraightforward (using
for
; slightly better): even-for.pyEven-number generator: even-yield.py
Not programming anything, but rather using
range()
’s step-width parameter: even-ultimate-pythonicity.py
-
Sequential search in output list (bad): uniq-sequential.py
Constant-time search in
set
(good): uniq-set.py
Tag 3¶
-
Using
dict.fromkeys()
: uniq-fromkeys.py
-
Talking about searchable datastructures, like in
dict
andset
(those are implemented as hash tables, btw.) -
Using
f.readline()
(EOF is clumsy): passwd-readline.pyPythonic, using iteration: passwd-iter.py
-
Larger OO/modules/database “project” see here
Tag 4¶
SQL
Exercise: larger OO/modules/database “project” see here