+ 1

My BMI Calculator needs help!

I have been stuck on this for days. PLEASE help!!!! weight=float(input()) height=float(input())*1000 BMI= weight/(height/100)**2 if BMI<=18.4: print('Underweight') elif BMI<=24: print("Normal") elif BMI<=29: print("Overweight") elif BMI>=30: print("Obesity") Underweight = less than 18.5 Normal = more or equal to 18.5 and less than 25 Overweight = more or equal to 25 and less than 30 Obesity = 30 or more

20th Dec 2021, 7:45 AM
Recode
Recode - avatar
9 odpowiedzi
+ 4
Recode, change first condition => if BMI < 18.5, second condition => elif BMI < 25, third...... < 30.
20th Dec 2021, 7:52 AM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Input seems confusing. And as you wrote under your code: The 'Normal' and 'Overweight' are in between 2 values. (Example: 18,5 < BMI <= 24 then Normal ) You should put 'and' in your code twice.
21st Dec 2021, 2:57 PM
SoloilSole
SoloilSole - avatar
+ 1
I did: weight = int(input()) height = float(input()) bmi = weight / height**2 This got me my variables. Then, you just specify conditions.
21st Dec 2021, 9:58 PM
Lucio Zuccheri
0
its still broken, it calculates all as underweight
20th Dec 2021, 8:17 AM
Recode
Recode - avatar
0
'Normal' and 'Overweight' cases have upper and lower limits.In ur code only upper limit is considered.Try the same. Good wishes
20th Dec 2021, 2:51 PM
Ravi V
Ravi V - avatar
0
Recode upon input you multiply height by 1000 (why?). Then in the final calculation you intended to restore it by dividing by 1000, however there is a typographical error and it divides by 100 instead of 1000. This causes the first condition always to be true, except for some ridiculous inputs. Also fix the range limits in your program. For instance, by comparing BMI<=24, there is a gap between 24 and 25 where your result is wrong. Why not use the proper limits as given in the task description (e.g., BMI<25)?
21st Dec 2021, 7:36 AM
Brian
Brian - avatar
0
https://code.sololearn.com/cBKB3ew0qj0r/?ref=app This is my bmi calculator, try it! Your code has the many errors, like the formula, the booleans and if you are doing it for your code project in Python for beginners, you don't need to convert input to float and you can convert to int, but I let u copy-paste from me and check the errors
21st Dec 2021, 1:17 PM
Some Guy Whit A Computer
Some Guy Whit A Computer - avatar
0
#check out my code 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") elif bmi>=30: print("Obesity")
28th Dec 2021, 6:20 PM
Silly 😜 Programmer