2025-02-20 22:17:08 +01:00

32 lines
984 B
Python

print("""
WILLKOMMEN ZUM ALKOHOLRECHNER
""")
geschlecht = input("Bist du ein Mann, eine Frau oder ein Kind? (m/f/k) ")
while geschlecht not in ['m', 'f', 'k']:
geschlecht = input("Bitte gib m, f oder k ein (Mann, Frau oder Kind). ")
faktor = 0.7 if geschlecht == 'm' else 0.6 if geschlecht == 'f' else 0.8
gewicht = int(input("Wie viel wiegst du? (in kg) "))
ready = False
counter = 0
drinks = []
while not ready:
counter += 1
prozent = float(input(f"Wieviel % Alkoholgehalt hat dein {counter}. Getränk? "))
anzahl = int(input(f"Wieviel ml hast du von deinem {counter}. Getränk getrunken? "))
fertig = input("Hast du noch etwas anderes getrunken? (j/n) ")
drinks.append([anzahl, prozent])
if fertig != "j":
ready = True
masse = sum([drink[0] * (drink[1]/100) * 0.8 for drink in drinks])
konzentration = masse / gewicht * faktor
print(f"Dein Blutalkoholgehalt liegt bei {konzentration:.3f} Promille")