- 1

Hi can anyone help me with the BMI calculator?

The calculator is working but it's only outputting under weight. Can anybody please help me? I checked it again and again but can't see the problem. https://code.sololearn.com/cJJPEUtpRRjE/?ref=app https://code.sololearn.com/cJJPEUtpRRjE/?ref=app

18th Mar 2022, 5:32 AM
Zyt
11 Respostas
+ 1
Zyt your inputs are reversed. Take weight first, then height.
18th Mar 2022, 9:41 PM
Brian
Brian - avatar
+ 1
Zyt The original problem description tells you the order that they will supply the inputs. The program cannot pass the tests if it does not take input correctly.
19th Mar 2022, 7:10 AM
Brian
Brian - avatar
+ 1
Wow, i should always read the problem properly lols. Thanks Brian! Appreciate it!
19th Mar 2022, 8:40 AM
Zyt
0
it outputs all of them for me, i assumed you used metric input as your equation is the metric one
18th Mar 2022, 5:56 AM
Raul Ramirez
Raul Ramirez - avatar
0
I don't think I understand what you mean, can you elaborate? Like what's wrong with my code?
18th Mar 2022, 6:00 AM
Zyt
0
1) there is no need for the while loop 2) it works regardless of the while loop As long as you you input metric values So enter your height in terms of meters And weight in terms of kg
18th Mar 2022, 6:03 AM
Raul Ramirez
Raul Ramirez - avatar
0
Am I going to use integer or float? I took out the while loop, as I get what u mean now but it still don't work? It only gives out underweight
18th Mar 2022, 6:13 AM
Zyt
0
None simply input metric values. Like ive said before Your code works lol you probably inputing the same values over and over
18th Mar 2022, 6:16 AM
Raul Ramirez
Raul Ramirez - avatar
0
It's actually for the projects that this app gives us to answer, on control flow, and I'm not the one who is testing it so I don't know what it's putting in.
18th Mar 2022, 6:20 AM
Zyt
0
They might be using imperial system ( lb, inches ) So try this BMI = 703 * weight / height **2
18th Mar 2022, 6:23 AM
Raul Ramirez
Raul Ramirez - avatar
0
Thanks! But how did that affect the whole code tho? I don't understand? is it because the BMI formula is weight/ height^2?
19th Mar 2022, 5:18 AM
Zyt