Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
gf_informatik:funktionen [2026-04-28 20:13] – [Aufgabe F5] hofgf_informatik:funktionen [2026-08-18 07:08] (aktuell) – [Aufgabe E3] hof
Zeile 180: Zeile 180:
     r = random.randint(1,3)     r = random.randint(1,3)
     if r == 1:     if r == 1:
-        print("Morgenstund ist aller Laster anfang!")+        print("Morgenstund ist aller Laster Anfang!")
     elif r == 2:     elif r == 2:
         print("Der Apfel fällt nicht weit vom Birnbaum!")         print("Der Apfel fällt nicht weit vom Birnbaum!")
Zeile 198: Zeile 198:
 === Aufgabe E4 === === Aufgabe E4 ===
  
-<bottom-exercise id="e3" layout="canvas" showswitcher>+<bottom-exercise id="e4" layout="canvas" showswitcher>
 <div slot="prompt"> <div slot="prompt">
 TurtleGraphics: Schreibe eine Funktion <code>square(x)</code>, die eine Zahl <code>x</code> als Argument entgegen nimmt und ein Quadrat mit dieser Länge zeichnet. TurtleGraphics: Schreibe eine Funktion <code>square(x)</code>, die eine Zahl <code>x</code> als Argument entgegen nimmt und ein Quadrat mit dieser Länge zeichnet.
Zeile 467: Zeile 467:
    * $x^2 + 2 x + 7 = 0$ hat keine Lösung    * $x^2 + 2 x + 7 = 0$ hat keine Lösung
  
-<nodisp 1> +<bottom-exercise id="f6"
- +<template data-type="solution">
-++++Lösungen Aufgaben F| +
- +
-==== Aufgaben F ==== +
- +
-=== Aufgabe F1 === +
- +
-<bottom-editor> +
-def volume_cube(x): +
-    return x**3 +
- +
-volume_cube(13) +
-print(v) +
-</bottom-editor> +
- +
-=== Aufgabe F2 === +
- +
-<bottom-editor> +
-import math +
-def pythagoras(a,b): +
-    return math.sqrt(a*a + b*b) +
- +
-print(pythagoras(3,4)) +
-</bottom-editor> +
- +
- +
-=== Aufgabe F3 === +
- +
-<bottom-editor> +
-import math +
-def volume_sphere(r): +
-    return 4*math.pi/3 * r**3 +
- +
-print(volume_sphere(3)) +
-</bottom-editor> +
- +
- +
-=== Aufgabe F4 === +
- +
-<bottom-editor> +
-def grade(points,points_6): +
-    gr = 5*points/points_6 + 1 +
-    if gr > 6: +
-        gr = 6.0 +
-    return round(gr,1) +
- +
-print(grade(23,51)) +
-</bottom-editor> +
- +
- +
-=== Aufgabe F5 === +
- +
-<bottom-editor> +
-def factorial(n): +
-    product = 1 +
-    i = 1 +
-    while i <= n: +
-         product = product * i +
-         i = i + 1 +
-    return product +
- +
-print(factorial(5)) +
-</bottom-editor> +
- +
- +
-=== Aufgabe F6 === +
- +
-<bottom-editor>+
 from math import * from math import *
 def mitternachtsformel(a,b,c): def mitternachtsformel(a,b,c):
Zeile 550: Zeile 483:
 print(mitternachtsformel(1,-4,4))  # 1 Loesung print(mitternachtsformel(1,-4,4))  # 1 Loesung
 print(mitternachtsformel(1,2,7))   # keine Loesung print(mitternachtsformel(1,2,7))   # keine Loesung
-</bottom-editor>+</template> 
 +<template data-type="test"> 
 +assert set(mitternachtsformel(3,-6,-5)) == {-0.632993161855452, 2.632993161855452} 
 +assert mitternachtsformel(1,-4,4) == 2 
 +assert mitternachtsformel(1,2,7) == None 
 +</template> 
 +</bottom-exercise>
  
-++++ 
- 
-</nodisp> 
  • gf_informatik/funktionen.1777407209.txt.gz
  • Zuletzt geändert: 2026-04-28 20:13
  • von hof