Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lehrkraefte:blc:informatik:glf4-20:simulation:python-repe [2021/03/27 10:05] Ivo Blöchliger [Selektion (if, elif, else)] |
lehrkraefte:blc:informatik:glf4-20:simulation:python-repe [2021/04/06 20:15] Ivo Blöchliger [Python Repetition / Cheat Sheet] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Python Repetition / Cheat Sheet ====== | ====== Python Repetition / Cheat Sheet ====== | ||
+ | Eine minimalistische Version gibt es [[lehrkraefte: | ||
+ | |||
+ | * Gehen Sie Beispiele von oben bis unten durch. | ||
+ | * Kopieren Sie jeweils den Code in TigerJython und führen Sie das jeweilige Programm aus. | ||
+ | * Versuchen Sie, jede Zeile der Programm zu verstehen. Wenn Sie nicht sicher sind, fügen sie '' | ||
+ | * Wenn Sie eine Zeile nicht verstehen, stellen Sie Fragen und/oder " | ||
+ | * Das Ziel ist nicht, alles auswendig zu wissen, aber zu wissen, was möglich ist und wo die Information zu finden ist. | ||
===== Variablen, Strings vs. Zahlen ===== | ===== Variablen, Strings vs. Zahlen ===== | ||
=== Variablen mit Zahlen === | === Variablen mit Zahlen === | ||
Line 9: | Line 16: | ||
print(bar) | print(bar) | ||
print(foo-bar) # Ausgabe 20 | print(foo-bar) # Ausgabe 20 | ||
+ | print(" | ||
+ | print(5**3) | ||
+ | print(" | ||
+ | print(2**0.5) | ||
</ | </ | ||
Line 97: | Line 108: | ||
quadratzahlen.append(i*i) | quadratzahlen.append(i*i) | ||
print(" | print(" | ||
+ | print(quadratzahlen) | ||
</ | </ | ||
Line 145: | Line 157: | ||
return zahlen | return zahlen | ||
- | foos = meineListe() | + | foos = meineListe() |
print(foos) | print(foos) | ||
</ | </ | ||
Line 161: | Line 173: | ||
<code python> | <code python> | ||
from random import randrange | from random import randrange | ||
- | for i in range(1, | + | for i in range(1, |
- | print(" | + | print(" |
</ | </ | ||
Uniform verteilte reelle Zahlen im Intervall $[0,1)$. | Uniform verteilte reelle Zahlen im Intervall $[0,1)$. |