Files
Functional/08_Laufzeit_Messung.py
T
2026-11-12 11:47:13 +01:00

25 lines
477 B
Python

import functools
import time
def time_calculation(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
start = time.perf_counter()
f(*args, **kwargs)
end = time.perf_counter()
print(f"Dauer: {end-start:.4f} Sekunden")
return wrapper
@time_calculation
def eine_funktion(a=1, b=2, c=3):
"""Eine funktion"""
for i in range(5000):
result = (a * b + c) * i
print(result)
eine_funktion()
help(eine_funktion)