Python :: Aufgabe #197 :: Lösung #4

8 Lösungen Lösungen öffentlich
#197

Body-Mass-Index (BMI)

Anfänger - Python von hollst - 20.11.2018 um 18:23 Uhr
Der BMI ist eine (umstrittene) Kenngröße zur Ermittlung des eigenen Über-/Untergewichtszustandes:

BMI = Körpermasse (kg) / Körpergröße zum Quadrat (m**2).

Er wird wie folgt interpretiert:

Starkes Untergewicht < 16
Mäßiges Untergewicht 16 – < 17
Leichtes Untergewicht 17 – < 18,5

Normalgewicht 18,5 – < 25

Präadipositas 25 – < 30

Adipositas Grad I 30 – < 35
Adipositas Grad II 35 – < 40
Adipositas Grad III ≥ 40

Man schreibe ein Programm, das die zwei Basisdaten (Körpermasse und Körpergröße) entgegennimmt und den
Zustand (Starkes Untergewicht, Mäßiges Untergewicht ... Adipositas Grad III) als Ergebnis mitteilt.

Viel Spaß!

#4
vote_ok
von kamikatze (420 Punkte) - 12.12.2018 um 20:35 Uhr
Quellcode ausblenden Python-Code
weight = (int(input("Dein Gewicht: ")))
height = (float(input("Deine roesse in cm: ")))

bmi = weight / ((height / 100)**2)
if bmi < 16:
    bmistatus = "Starkes Untergewicht"
elif (bmi >= 16) and (bmi < 17):
    bmistatus = "Maesiges Untergewicht"
elif (bmi >= 17) and (bmi < 18.5):
    bmistatus = "Leichtes Untergewicht "
elif (bmi >= 18.5) and (bmi < 25):
    bmistatus = "Normalgewicht "
elif (bmi >= 25) and (bmi < 30):
    bmistatus = "Praeadipositas "
elif (bmi >= 30) and (bmi < 35):
    bmistatus = "Adipositas Grad I "
elif (bmi >= 35) and (bmi < 40):
    bmistatus = "Adipositas Grad II "
elif (bmi >= 40):
    bmistatus = "Adipositas Grad III "

print("du hast ", bmistatus)

Kommentare:

Für diese Lösung gibt es noch keinen Kommentar

Bitte melden Sie sich an um eine Kommentar zu schreiben.
Kommentar schreiben