0
BMI calculator bug?
Iām having trouble getting my code to output anything other than underweight. Hopefully yāallās can help me understand what I have wrong here weight = int(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")
2 Answers
+ 6
Don't put your condition inside quotation marks. Currently you are checking if a string is true, and a nonempty string is always evaluated to true, that's why you always get underweight.
+ 1
Thank you been wracking my brain over this for a day im glad it was a simple fix