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

BMI calculator

while input == 'metric': height = float(()) weight = int(()) bmi = weight/(height*height) if bmi <18.5: print('Underweight') elif bmi >=18.5 and <25: print('Normal') elif bmi >=25 and <30: print('Normal') else: print('Obesity') What is correct code for BMI calculation excercise

28th May 2021, 5:25 PM
Jitender Thakur
Jitender Thakur - avatar
4 Answers
+ 1
#your code goes here weight=int(input()) height=float(input()) BMI = weight/(height**2) if BMI <= 18.5: print("Underweight") elif BMI <= 25: print("Normal") elif BMI <=30: print("Overweight") else : print("Obesity")
28th May 2021, 5:31 PM
Rupa Reddy
Rupa Reddy - avatar
+ 1
It worked.. i misunderstood the problem.. for normal bmi score is >=18 and <25.. Thank you!
28th May 2021, 5:39 PM
Jitender Thakur
Jitender Thakur - avatar
0
#your code goes here weight = float(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') elif bmi >= 30: print('Obesity') Copy and paste my answer If it is right vote me
19th Aug 2021, 7:17 AM
Sariga.S
0
#your code goes here weight = float(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') elif bmi >= 30: print('Obesity') Copy and paste my answer If it is right please vote for me
19th Aug 2021, 7:21 AM
Sariga.S