I need help fixing my bmi calculator (Solved!) | Sololearn: Learn to code for FREE!

+1

# I need help fixing my bmi calculator (Solved!)

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

5/19/2022 8:53:45 AM

Sun1

+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)

+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

+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" ..

+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.

0

0

Good luck!

0

If comparing other bmi calculater, what are your inputs to your calculator? Sun1 want to know just you are inputs are in proper...

0

do you mean by what I input or like the int and float inputs?

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.

0

nvm I finally kinda realized my mistake.