Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
lehrkraefte:snr:informatik:glf22:python:listen [2022/10/25 21:15] Olaf Schnürer [Listen erzeugen mit "interner for-Schleife"] |
lehrkraefte:snr:informatik:glf22:python:listen [2023/01/19 23:26] Olaf Schnürer [Listen von Zahlen graphisch darstellen] |
||
---|---|---|---|
Line 356: | Line 356: | ||
(2) Eine Liste aus 20 Elementen, deren $i$-tes Element die $i$-fache Hintereinanderschreibung des Worts " | (2) Eine Liste aus 20 Elementen, deren $i$-tes Element die $i$-fache Hintereinanderschreibung des Worts " | ||
- | (3) Die Liste aller ganzen Zahlen von 5 bis 20. | + | (3) Die Liste aller (ganzen) Zahlen von 5 bis 20. |
(4) Die Liste aller Zahlen von 7 bis 97 "mit Schrittweite 10", also die Liste '' | (4) Die Liste aller Zahlen von 7 bis 97 "mit Schrittweite 10", also die Liste '' | ||
Line 535: | Line 535: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | ===== Listen von Zahlen graphisch darstellen ===== | ||
+ | |||
+ | <code python saeulendiagramm.py> | ||
+ | from matplotlib import pyplot | ||
+ | |||
+ | xWerte = [i for i in range(-10, 30)] | ||
+ | yWerte = [(x-3)*(x+2)*(x-25) for x in xWerte] | ||
+ | pyplot.bar(xWerte, | ||
+ | pyplot.show() | ||
+ | </ | ||
+ | |||
+ | <code python graph.py> | ||
+ | from matplotlib import pyplot | ||
+ | |||
+ | xWerte = [i for i in range(-10, 30)] | ||
+ | yWerte = [(x-3)*(x+2)*(x-25) for x in xWerte] | ||
+ | pyplot.plot(xWerte, | ||
+ | pyplot.show() | ||
+ | </ | ||
===== Weiteres Material ===== | ===== Weiteres Material ===== |