Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
lehrkraefte:blc:informatik:glf4-20:simulation:python-mini-cheat-sheet [2021/04/06 20:10] Ivo Blöchliger created |
lehrkraefte:blc:informatik:glf4-20:simulation:python-mini-cheat-sheet [2021/04/07 08:40] (current) Ivo Blöchliger [Listen] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Python Micro-Cheat-Sheet ====== | ||
+ | Ein ausführlicheres Cheat-Sheet gibt es [[lehrkraefte: | ||
==== Wiederholung ==== | ==== Wiederholung ==== | ||
<code python> | <code python> | ||
Line 10: | Line 12: | ||
liste=[] | liste=[] | ||
for i in range(6): | for i in range(6): | ||
- | liste.append(i*2) | + | liste.append(i*2) |
print(liste) | print(liste) | ||
</ | </ | ||
Line 16: | Line 18: | ||
<code python> | <code python> | ||
liste = [23, | liste = [23, | ||
- | csv = " | + | csv = " |
for index in range(len(liste)): | for index in range(len(liste)): | ||
csv += " | csv += " | ||
Line 29: | Line 31: | ||
</ | </ | ||
+ | ==== Funktionen ==== | ||
+ | <code python> | ||
+ | # Definition der Funktion, wird nicht direkt ausgeführt. | ||
+ | def quadrat(x): | ||
+ | return x*x # Quadrat von x berechnen und als Resultat zurückgeben. | ||
+ | x = 42 | ||
+ | print(" | ||
+ | print(" | ||
+ | </ |