BMI Calculator | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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.

30th May 2022, 2:34 PM
Abin Thomas
3 Respostas
+ 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')
30th May 2022, 2:47 PM
Raju Adhikary
Raju Adhikary - avatar
+ 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")
30th May 2022, 2:57 PM
Per Bratthammar
Per Bratthammar - avatar
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')
12th Jun 2022, 3:33 AM
NĆ­colas Nascimento
NĆ­colas Nascimento - avatar