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:ffprg1-2020:loops [2022/02/17 12:44] Ivo Blöchliger [while-loops] |
lehrkraefte:blc:informatik:ffprg1-2020:loops [2022/04/07 13:16] Ivo Blöchliger [Aufgaben] |
||
---|---|---|---|
Line 53: | Line 53: | ||
while True: | while True: | ||
| | ||
- | | + | |
</ | </ | ||
Line 71: | Line 71: | ||
a = 1 | a = 1 | ||
while a<10: | while a<10: | ||
- | if a%2==0: | + | if a%2==0: |
a+=3 | a+=3 | ||
| | ||
Line 93: | Line 93: | ||
print(" | print(" | ||
</ | </ | ||
- | Leider wird damit auch ein Leerschlag eingefügt. | + | Leider wird damit auch ein Leerschlag eingefügt. |
- | <code python> | + | |
- | import sys | + | |
- | + | ||
- | sys.stdout.write(" | + | |
- | sys.stdout.write(" | + | |
- | </ | + | |
- | Oder noch einfacher, man erstellt | + | Noch mehr Kontrolle hat man, wen man die ganze Zeile erst in einem String |
<code python> | <code python> | ||
zeile = "Die Zahlen 1" | zeile = "Die Zahlen 1" | ||
Line 117: | Line 111: | ||
Sie können wie folgt überprüfen, | Sie können wie folgt überprüfen, | ||
<code python> | <code python> | ||
- | if a % b == 0: # Wenn der Rest der Division von a durch b gleich Null ist, ist a druch b teilbar | + | if a % b == 0: # Wenn der Rest der Division von a durch b gleich Null ist, ist a durch b teilbar |
# Tu was | # Tu was | ||
</ | </ |