Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung
gf_informatik:funktionen [2026-04-28 20:13] – [Aufgabe F5] hofgf_informatik:funktionen [2026-04-28 20:19] (aktuell) – [Aufgabe F6 (optional)] hof
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