0
Help debug this code
def bmi (weight, height): BMI = weight / (height * height) return BMI weight = float(input("Input user weight: ")) height = float(input("Input user height: ")) value = bmi (weight, height) if (value < 18.5): print ("Underweight") elif (value >= 18.5 and value <= 24.9): print ("Normal") elif (value >= 25 and value <= 29.9): print ("Overweight") else: print ("Obese")
3 Réponses
+ 4
Provide a complete task instruction.
Mind the exact wording of the output.
Do not use input prompt text.
Be exact about the edge values in the if-else chain.
+ 1
Follow Lisa's directions. Expanding on her last point, there is an implementation error in the code. Consider what would happen in the main logic if value is between 24.9 and 25 (like if value = 24.95). The output would be "Obese", which is incorrect. Adjust the logic to use only exact thresholds of 18.5, 25, and 30.
0
Iwuchukwu Chibuike Damian ,
as far as i can see, you should check the values that define the weight ranges.
> what happens if the weight is 24.91? for: elif (value >= 18.5 and value <= 24.9):



