00:02
Looks like this time they want us to calculate body mass index from let's see weight in pounds and height and inches so that's going to be a three -step program in the second step we're going to calculate bmi well what's the first step we have to calculate it from those variables we're going to let's see prompt the user for them or weight and height remember whenever we get input from the console we're going to need to convert from strings to numbers so we can do our calculations with them because we can't do number calculations on text and then after we calculate that we're going to display to the user so let's see looks like they do it into separate lines so we'll match them number we need to convert to a number so we'll call eval on our input that we get from the user and we're going to specifically ask them to enter weight in pounds now we're going to do something similar for height.
01:22
Let's try it out with your height and inches.
01:38
Then they give us, let's see, they describe the formula for calculating bmi formula.
01:50
Let's see.
01:52
Taking your weight and dividing it by height squared.
02:08
So it looks like they divide by the square of the height in.
02:21
Meters but we're asking for inches so let's see we're never how to convert inches to meters well one inch is 0 .0 to 4 meters let's see let's do that conversion inches for every inch there's that many meters and that's what we're going to squirt is the weight also in pounds no it's going to be your weight in kilograms so we're also going to need to convert from pounds to kilograms one pound is 0 .45453592 kilograms so we can use that formula.
03:24
Could that we double checked carefully what the problem wanted because if we compute the wrong answer and say this was four codes for maybe adjusting like a self -driving car to the weight of its passengers or a satellite in space that needed very specific units.
03:52
You calculate it wrong and you're going to miss your target by quite a large amount.
03:55
That could be very worrying, right? so let's display to the console.
04:02
We'll have to use print.
04:04
The message we're going to give is just bmi is.
04:08
We show them our calculated value...