From e66e54c42418a32415240b3b7515bc518c9bc37b Mon Sep 17 00:00:00 2001 From: moerp Date: Sun, 7 Apr 2024 20:00:16 +0200 Subject: [PATCH] sd --- src/Run.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Run.py b/src/Run.py index 094ed55..943a751 100644 --- a/src/Run.py +++ b/src/Run.py @@ -53,12 +53,18 @@ def calculate_nutrition(food, weight): conn.close() -def schulrunden(zahl): + + +def schulrunden(zahl, stellen=0): + faktor = 10 ** stellen + zahl = zahl * faktor basis = floor(zahl) if zahl - basis >= 0.5: - return basis + 1 + gerundet = basis + 1 else: - return basis + gerundet = basis + return gerundet / faktor + # Index-Route