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 [2025-11-20 13:12] – [Funktionen] hofgf_informatik:funktionen [2025-11-20 13:59] (aktuell) – [Aufgabe E5] hof
Zeile 56: Zeile 56:
 <html><bottom-editor> <html><bottom-editor>
 def say_hi(name): def say_hi(name):
-    print("Hallo " + name + "!")+    print(f"Hallo {name}!")
  
 say_hi("Silvia") say_hi("Silvia")
Zeile 182: Zeile 182:
 === Aufgabe E1 === === Aufgabe E1 ===
  
-<code python>+<html><bottom-editor>
 def greetings(name,residence): def greetings(name,residence):
-    print("Hallo, mein(e) liebe(r) " + name + " aus " + residence + ". Ich wünsche dir einen ganz tollen Tag!")+    print(f"Hallo, mein(e) liebe(r) {nameaus {residence}. Ich wünsche dir einen ganz tollen Tag!")
  
-greetings("Fritz","Romanshorn"+greetings("Fritz", "Romanshorn"
-greetings("Monika","Amriswil"+greetings("Monika", "Amriswil"
-</code>+</bottom-editor></html>
  
 === Aufgabe E2 === === Aufgabe E2 ===
  
-<code python>+<html><bottom-editor>
 import random import random
  
Zeile 208: Zeile 208:
 head_or_tail() head_or_tail()
 head_or_tail() head_or_tail()
-</code>+</bottom-editor></html>
  
 === Aufgabe E3 === === Aufgabe E3 ===
  
-<code python>+<html><bottom-editor>
 import random import random
  
Zeile 218: Zeile 218:
     r = random.randint(1,3)     r = random.randint(1,3)
     if r == 1:     if r == 1:
-        print("Spruch 1")+        print("Morgenstund ist aller Laster anfang!")
     elif r == 2:     elif r == 2:
-        print("Spruch 2")+        print("Der Apfel fällt nicht weit vom Birnbaum!")
     else:     else:
-        print("Spruch 3") +        print("Wer andern in der Nase bohrt, ist selbst ein Schwein.") 
-</code>+ 
 +fortune_cookie() 
 +</bottom-editor></html>
  
 === Aufgabe E4 === === Aufgabe E4 ===
Zeile 368: Zeile 370:
 === Aufgabe F1 === === Aufgabe F1 ===
  
-<code python>+<html><bottom-editor>
 def volume_cube(x): def volume_cube(x):
     return x**3     return x**3
Zeile 374: Zeile 376:
 v = volume_cube(13) v = volume_cube(13)
 print(v) print(v)
-</code>+</bottom-editor></html>
  
 === Aufgabe F2 === === Aufgabe F2 ===
  
-<code python>+<html><bottom-editor> 
 +import math
 def pythagoras(a,b): def pythagoras(a,b):
-    return sqrt(a*a + b*b)+    return math.sqrt(a*a + b*b)
  
 print(pythagoras(3,4)) print(pythagoras(3,4))
-</code>+</bottom-editor></html>
  
  
 === Aufgabe F3 === === Aufgabe F3 ===
  
-<code python>+<html><bottom-editor>
 import math import math
 def volume_sphere(r): def volume_sphere(r):
Zeile 394: Zeile 397:
  
 print(volume_sphere(3)) print(volume_sphere(3))
-</code>+</bottom-editor></html>
  
  
 === Aufgabe F4 === === Aufgabe F4 ===
  
-<code python>+<html><bottom-editor>
 def grade(points,points_6): def grade(points,points_6):
     gr = 5*points/points_6 + 1     gr = 5*points/points_6 + 1
Zeile 407: Zeile 410:
  
 print(grade(23,51)) print(grade(23,51))
-</code>+</bottom-editor></html>
  
  
 === Aufgabe F5 === === Aufgabe F5 ===
  
-<code python>+<html><bottom-editor>
 def factorial(n): def factorial(n):
     product = 1     product = 1
Zeile 422: Zeile 425:
  
 print(factorial(5)) print(factorial(5))
-</code>+</bottom-editor></html>
  
  
 === Aufgabe F6 === === Aufgabe F6 ===
  
-<code python>+<html><bottom-editor> 
 +from math import *
 def mitternachtsformel(a,b,c): def mitternachtsformel(a,b,c):
     d = b*b - 4*a*c     d = b*b - 4*a*c
Zeile 441: Zeile 445:
 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
-</code>+</bottom-editor></html>
  
 ++++ ++++
  
 </nodisp> </nodisp>
  • gf_informatik/funktionen.1763644372.txt.gz
  • Zuletzt geändert: 2025-11-20 13:12
  • von hof