+ 1

Hi. I want to know why my code is failing. There is 1/5 test that breaks when execute and i really don't know why.

Here My code: peso = int(input()) altura = float(input()) imc = peso / (altura*altura) if imc < 18.5: print ('Underweight') if imc > 18.5 and imc <= 24.9: print ('Normal') if imc > 25.0 and imc <= 29.9: print ('Overweight') if imc > 30.0: print ('Obesity')

14th Dec 2022, 4:47 PM
david sebastian perez saenz
2 Antworten
+ 8
What happens if imc = 18.5. And why do you not use imc < 25? Why 24.9. What happens if imc = 25?
14th Dec 2022, 5:01 PM
Paul
Paul - avatar
+ 1
Thank you. I think the problem was the floats between the units.
14th Dec 2022, 5:21 PM
david sebastian perez saenz