Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
lehrkraefte:snr:informatik:python:loops [2021/09/15 18:35] Olaf Schnürer [Bonus-Aufgaben] |
lehrkraefte:snr:informatik:python:loops [2021/09/22 14:41] (current) Olaf Schnürer [Verschachtelte for-Schleifen] |
||
---|---|---|---|
Line 100: | Line 100: | ||
<code python> | <code python> | ||
for i in range(3): | for i in range(3): | ||
- | print(" | + | print(" |
for j in range(3): | for j in range(3): | ||
print(" | print(" | ||
print(" | print(" | ||
print(" | print(" | ||
- | print(" | + | print(" |
</ | </ | ||
Line 161: | Line 161: | ||
</ | </ | ||
+ | 2dNP bis hier 22.09.2021 | ||
===== Bonus-Aufgaben ===== | ===== Bonus-Aufgaben ===== | ||
+ | |||
+ | <WRAP round todo> | ||
+ | Schreibe ein Programm, dass abhängig von einer Variablen '' | ||
+ | <code text> | ||
+ | +1+2+3+4+5+6+7+8+9+10=55 | ||
+ | </ | ||
+ | <hidden Hinweis:> | ||
+ | |||
+ | Das Folgende soll nicht verwendet werden, gehört aber zur mathematischen Allgemeinbildung: | ||
+ | <WRAP round info 70%> | ||
+ | Die [[https:// | ||
+ | $ \frac{n (n+1)}2$ | ||
+ | ist, in Formeln: | ||
+ | $$1+2+\dots+n = \frac{n(n+1)}{2}$$ | ||
+ | </ | ||
+ | </ | ||
<WRAP round todo> | <WRAP round todo> | ||
Line 189: | Line 206: | ||
</ | </ | ||
</ | </ | ||
- | |||
- | |||
- | <WRAP round todo> | ||
- | Schreibe ein Programm, dass abhängig von einer Variablen '' | ||
- | <code text> | ||
- | +1+2+3+4+5+6+7+8+9+10=55 | ||
- | </ | ||
- | <hidden Hinweis:> | ||
- | |||
- | Das Folgende soll nicht verwendet werden, gehört aber zur mathematischen Allgemeinbildung: | ||
- | <WRAP round info 70%> | ||
- | Die [[https:// | ||
- | $ \frac{n (n+1)}2$ | ||
- | ist, in Formeln: | ||
- | $$1+2+\dots+n = \frac{n(n+1)}{2}$$ | ||
- | </ | ||
- | </ | ||
- | |||
===== Einige Lösungsvorschläge ===== | ===== Einige Lösungsvorschläge ===== | ||
Line 225: | Line 224: | ||
print(" | print(" | ||
x = x * (1 + zunahme_prozent / 100) | x = x * (1 + zunahme_prozent / 100) | ||
- | </ | ||
- | </ | ||
- | |||
- | <hidden Summe der ersten $n$ Zahlen> | ||
- | <code python> | ||
- | n = 10 | ||
- | summe = 0 | ||
- | ausgabe = "" | ||
- | for i in range(1, | ||
- | summe = summe + i | ||
- | ausgabe = ausgabe + " | ||
- | # Alternativ: ausgabe = ausgabe + " | ||
- | print(ausgabe + " | ||
</ | </ | ||
</ | </ | ||
Line 257: | Line 243: | ||
s = s + " | s = s + " | ||
print(s) | print(s) | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <hidden Summe der ersten $n$ Zahlen> | ||
+ | <code python> | ||
+ | n = 10 | ||
+ | summe = 0 | ||
+ | ausgabe = "" | ||
+ | for i in range(1, | ||
+ | summe = summe + i | ||
+ | ausgabe = ausgabe + " | ||
+ | # Alternativ: ausgabe = ausgabe + " | ||
+ | print(ausgabe + " | ||
</ | </ | ||
</ | </ |