+ 1

I need help fixing my bmi calculator (Solved!)

https://code.sololearn.com/cTJRlSo5bxBY/?ref=app

19th May 2022, 8:53 AM
Sun1
10 Antworten
+ 2
It works for me. I suggest specifying the units. The formula you use applies to kg/m² hence you should specify that height must be in metres and not anything else. I used 1.7 and 80 and received the second message. Also, bmi = 18 would give conflicting answers. I would suggest including a healthy bmi range in the future)
19th May 2022, 8:58 AM
Masha
Masha - avatar
+ 2
No. I understand it now. Others bmi (code coach task) takes weight as first input and height as second so just asking,do you aware of it! Program is correct but enter input as per program.. Taking both floats no problem, but Height must be in float type. Bmi <= 18 condition covers all bmi less than 18. So second <18 no need. Never works also. Next conditions must check for Bmi greater than 18
19th May 2022, 9:31 AM
Jayakrishna 🇮🇳
+ 2
In between 18 and 20, both inclusive ? if bmi >= 18 and bmi <=20 : Or also in python if 18<= bmi <= 20 : works fine. your condition works for " not between 18 and 20" ..
19th May 2022, 10:21 AM
Jayakrishna 🇮🇳
+ 1
so how do you code bmi <=18 or bmi>20 without getting an error? because I tried adding putting and in between but it always gives me errors.
19th May 2022, 9:36 AM
Sun1
0
thank you a lot for your advise
19th May 2022, 9:00 AM
Sun1
0
Good luck!
19th May 2022, 9:01 AM
Masha
Masha - avatar
0
If comparing other bmi calculater, what are your inputs to your calculator? Sun1 want to know just you are inputs are in proper...
19th May 2022, 9:17 AM
Jayakrishna 🇮🇳
0
do you mean by what I input or like the int and float inputs?
19th May 2022, 9:20 AM
Sun1
0
well this is my first time making so if i were to say my inputs were proper then no not really I'm just putting in random numbers to see if it would give me a good output.
19th May 2022, 9:24 AM
Sun1
0
nvm I finally kinda realized my mistake.
19th May 2022, 9:27 AM
Sun1