BMI calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

BMI calculator

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

7th Nov 2021, 1:18 PM
Milena
7 Answers
+ 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
7th Nov 2021, 1:31 PM
Aliul Nadab
Aliul Nadab - avatar
+ 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!
7th Nov 2021, 1:41 PM
Lothar
Lothar - avatar
+ 1
@Lothar, hi! i did actually write the code myself before i asked the question i just forgot to link it :))
7th Nov 2021, 3:41 PM
Milena
+ 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")
8th Nov 2021, 8:49 PM
Qvuark
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
8th Nov 2021, 3:09 PM
👑𝕾𝖆𝖎𝖋 𝕾𝖍𝖆𝖍𝖗𝖎𝖆𝖗👨🏻‍💻[8UG HUNT3R]🎖️
👑𝕾𝖆𝖎𝖋 𝕾𝖍𝖆𝖍𝖗𝖎𝖆𝖗👨🏻‍💻[8UG HUNT3R]🎖️ - avatar
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')
11th May 2022, 5:34 PM
MYusuf
MYusuf - avatar