0
BMI Calculator
weight = float(input()) height = float(input()) x = float(weight) / float(height * height) if x < 18.5: print("Underweight") if x >=18 and x < 25: print("Normal") if x >= 25 and x < 30: print("Overweight") if x >= 30: print("Obesity") Please let me know where I went wrong.
3 Réponses
+ 1
weight = float(input())
height= float(input())
x = int(weight/height**2)
if x < 18.5:
print('Underweight')
elif x >= 18.5 and x < 25:
print('Normal')
elif x >= 25 and x < 30:
print('Overweight')
elif x >= 30:
print('Obesity')
+ 1
# Hi! You can try this one, using elif instead of a lot of if:
weight = float(input())
height = float(input())
x = weight / (height * height)
print(x)
if x < 18.5:
print("Underweight")
elif x < 25:
print("Normal")
elif x < 30:
print("Overweight")
else:
print("Obesity")
0
weight = float(input(''))
height = float(input(''))
bmi = weight / (height ** 2)
if bmi < 18.5:
print('Underweight')
elif bmi >= 18.5 and bmi < 25:
print('Normal')
elif bmi >= 25 and bmi < 30:
print('Overweight')
else:
print('Obesity')