sd
This commit is contained in:
12
src/Run.py
12
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
|
||||
|
Reference in New Issue
Block a user