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 [Aufgabe zum 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 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 ===== |