0
BMI calculator
does anyone know how to do this i’m so confused
7 Réponses
+ 3
Here is the concept......To calculate your BMI, you need to divide your weight in kilograms by your height in metres squared.
And you have to compare your result with this..👇
Normal Weight: 18.5 - 24.9
Overweight: 25 - 29.9
Underweight: <18.5
+ 3
Milena ,
you have started with sololearn just 1 day ago, and you have not started to learn a tutorial.
i can fully understand that you are confused. since sololearn is a self-learner platform, it is recommended that you start with a python tutorial, do learning and practicing. this will help you to get able to solve the exercises. if you get stuck somewhere, come back with a question.
what we are not doing is showing code for askers, if they don't have shown us their attempt.
thanks for your undersranding!
+ 1
@Lothar, hi! i did actually write the code myself before i asked the question i just forgot to link it :))
+ 1
x = float(input(""))
y = float(input(""))
z = (x/(y**2))
if z <= 19.5:
print("Underweight")
elif z >= 19.5 and z < 25:
print("Normal")
elif z >= 25 and z < 30:
print("Overweight")
elif z > 30:
print("Obesity")
0
First you have to take the input of weight in integer, then height in float.
After that, you have to calculate the BMI.
Then use else/if to determine the corresponding statements to the expression.
Under 18.5: Underweight
18.5 - under 25: Normal
25 - under 30: Overweight
30 and more: Obesity
0
It worked in me:
#your code goes here
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')
else:
print('Obesity')
- 1
Use search option to get help
https://www.sololearn.com/discuss/2687547/?ref=app
https://www.sololearn.com/discuss/2686011/?ref=app
https://www.sololearn.com/discuss/2748154/?ref=app
https://www.sololearn.com/discuss/2776665/?ref=app
https://www.sololearn.com/discuss/2845180/?ref=app
https://www.sololearn.com/discuss/2795746/?ref=app
https://www.sololearn.com/discuss/2892961/?ref=app