This code have something wrong and I don't now what | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

This code have something wrong and I don't now what

peso = float(input()) altura = float(input()) IMC = (peso/altura**2) if IMC < 18.5: print ("Underweight") if IMC >= 18.5 and IMC <= 24.9: print ("Normal") if IMC >= 25 and IMC <= 29.9: print ("Overweight") if IMC >= 30: print ("Obesity") This should be an imc calculator, and works, but when I run, the case 4 doesn't work, and didn't show me what I put wrong

23rd Apr 2022, 3:05 PM
franco badano
franco badano - avatar
1 Answer
+ 1
what if IMC like for 24.999 , 29.99 : instead take <25, <30 as boundaries.. make use of elif
23rd Apr 2022, 3:12 PM
Jayakrishna 🇮🇳