BMI calculator | Sololearn: Learn to code for FREE!


BMI calculator

does anyone know how to do this i’m so confused

11/7/2021 1:18:13 PM


7 Answers

New Answer


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


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!


@Lothar, hi! i did actually write the code myself before i asked the question i just forgot to link it :))


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


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


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


Use search option to get help