+ 3

What is wrong with my code?

Calculadora imc

4th Jun 2021, 11:25 AM
Leonel Àlvarez Aguayo
7 Respuestas
+ 2
I think you need to round the IMC, just add the following after 3th line: >> imc = round(imc, 1) This is because your if statement is with only one decimal to evaluate. I hope this resolve your question.
4th Jun 2021, 12:02 PM
CLAD
CLAD - avatar
+ 2
Thank you, now, I trying on this way
4th Jun 2021, 12:48 PM
Leonel Àlvarez Aguayo
0
peso = float(input()) altura = float(input()) imc = (peso/(altura**2)) if imc < 18.5: print("Underweight") elif 18.5 <= imc <= 24.9: print("Normal") elif 25 <= imc <= 29.9: print("Overweight") elif imc > 30: print("Obesity")
4th Jun 2021, 11:39 AM
Leonel Àlvarez Aguayo
4th Jun 2021, 12:04 PM
Leonel Àlvarez Aguayo
0
elif imc >= 30: print('Obesity')
7th Aug 2021, 4:29 AM
Walter Gimenez
Walter Gimenez - avatar