Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Nächste Überarbeitung | Vorherige Überarbeitung | ||
| gf_informatik:funktionen:aufgaben_a [2026-05-08 06:04] – angelegt gra | gf_informatik:funktionen:aufgaben_a [2026-05-08 09:29] (aktuell) – [Aufgaben NA – Einfache Funktionen ohne Rückgabewerte] gra | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ==== Aufgaben | + | ==== Aufgaben |
| Die folgenden Aufgaben behandeln Funktionen mit und ohne Argumente – aber ohne Rückgabewerte. | Die folgenden Aufgaben behandeln Funktionen mit und ohne Argumente – aber ohne Rückgabewerte. | ||
| + | Hier gehts zur Übersicht: [[gf_informatik: | ||
| === NA1 – Blumen === | === NA1 – Blumen === | ||
| Schreibe eine Funktion namens '' | Schreibe eine Funktion namens '' | ||
| Zeile 59: | Zeile 60: | ||
| <color # | <color # | ||
| + | |||
| + | ==== Lösungen ==== | ||
| + | |||
| + | <nodisp 2> | ||
| + | ++++Lösungen zu Aufgaben NA:| | ||
| + | === NA1 === | ||
| + | <code python> | ||
| + | from gturtle import * | ||
| + | flori = Turtle() | ||
| + | |||
| + | def blume(): | ||
| + | flori.setPenColor(" | ||
| + | i = 0 | ||
| + | while i < 6: | ||
| + | flori.rightArc(20, | ||
| + | flori.dot(30) | ||
| + | i = i + 1 | ||
| + | |||
| + | blume() | ||
| + | flori.setPos(60, | ||
| + | blume() | ||
| + | flori.setPos(100, | ||
| + | blume() | ||
| + | </ | ||
| + | |||
| + | === NA2 === | ||
| + | <code python> | ||
| + | from gturtle import * | ||
| + | flori = Turtle() | ||
| + | |||
| + | def blume(color): | ||
| + | flori.setPenColor(color) | ||
| + | i = 0 | ||
| + | while i < 6: | ||
| + | flori.rightArc(20, | ||
| + | flori.dot(30) | ||
| + | i = i + 1 | ||
| + | |||
| + | blume(" | ||
| + | flori.setPos(60, | ||
| + | blume(" | ||
| + | flori.setPos(80, | ||
| + | blume(" | ||
| + | flori.setPos(140, | ||
| + | blume(" | ||
| + | </ | ||
| + | |||
| + | === NA3 – Schritt 1 === | ||
| + | <code python> | ||
| + | from gturtle import * | ||
| + | flori = Turtle() | ||
| + | |||
| + | def blume(color, | ||
| + | flori.setPenColor(color) | ||
| + | flori.setPos(xpos, | ||
| + | i = 0 | ||
| + | while i < 6: | ||
| + | flori.rightArc(20, | ||
| + | flori.dot(30) | ||
| + | i = i + 1 | ||
| + | x = 0 | ||
| + | while x < 600: | ||
| + | blume(" | ||
| + | x = x + 100 | ||
| + | </ | ||
| + | |||
| + | === NA3 – Schritt 2 === | ||
| + | <code python> | ||
| + | from gturtle import * | ||
| + | flori = Turtle() | ||
| + | |||
| + | def blume(color, | ||
| + | flori.setPenColor(color) | ||
| + | flori.setPos(xpos, | ||
| + | i = 0 | ||
| + | while i < 6: | ||
| + | flori.rightArc(20, | ||
| + | flori.dot(30) | ||
| + | i = i + 1 | ||
| + | |||
| + | colors = [" | ||
| + | xpositions = [0, | ||
| + | ypositions = [0, | ||
| + | |||
| + | i = 0 | ||
| + | while i < 6: | ||
| + | blume(colors[i], | ||
| + | i = i + 1 | ||
| + | </ | ||
| + | |||
| + | === NA4 === | ||
| + | <code python> | ||
| + | from gturtle import * | ||
| + | flori = Turtle() | ||
| + | flori.hideTurtle() | ||
| + | flori.clear(" | ||
| + | |||
| + | def blume(color, | ||
| + | flori.setPenColor(color) | ||
| + | flori.setPos(xpos, | ||
| + | i = 0 | ||
| + | while i < 6: | ||
| + | flori.rightArc(20, | ||
| + | flori.dot(30) | ||
| + | i = i + 1 | ||
| + | |||
| + | colors = [" | ||
| + | |||
| + | i = 0 | ||
| + | while i < 20: | ||
| + | col_pos = random.randint(0, | ||
| + | blume(colors[col_pos], | ||
| + | i = i + 1 | ||
| + | </ | ||
| + | ++++ | ||
| + | </ | ||
| + | |||