Verzeichnis für teil28

This commit is contained in:
Olli Graf
2024-10-25 14:03:27 +02:00
parent af36c44e66
commit fec0969d7f
12 changed files with 2 additions and 0 deletions

16
teil28/func_param.py Normal file
View File

@@ -0,0 +1,16 @@
# Datei: func_param.py
def add(x, y):
return x + y
def mul(x,y):
return x * y
def calculate(func, x, y):
return func(x, y)
result = calculate(add, 4, 6) # Aufruf von calculate mit add Funktion als Parameter
print(result) # Ausgabe ist 10
result = calculate(mul, 4, 6) # Aufruf von calculate mit add Funktion als Parameter
print(result) # Ausgabe ist 24