0

BMI Calculator

Please help me to solve BMI Calculator with python??

4th Feb 2021, 12:13 AM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar
74 Answers
+ 21
there's no needs of () around condition in python, but it's still valid with... similarly, there's no needs of combining conditions, as this will work as well: bmi = float(input())/float(input())**2 if bmi<18.5: print('Underweight') elif bmi<25: print('Normal') elif bmi<30: print('OverWeight') else: print('Obesity')
20th Mar 2021, 1:35 AM
visph
visph - avatar
+ 17
w=int(input()) h=float(input ()) bmi=(w/(h**2)) while bmi<18.5: print("Underweight") break while bmi>18.5: print ("Normal") break while bmi>25.0: print ("Overweight") break while bmi>30.0: print ("Obesity") break
4th Feb 2021, 5:23 AM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar
+ 9
x = int(input()) y = float(input()) if(x/(y**2))<18.5: print ('Underweight') elif (x/(y**2)) <25: print ('Normal') elif (x/(y**2))<30: print ('Overweight') elif (x/(y**2)) > 31: print ('Obesity')
12th Jul 2021, 8:09 AM
fatiyaa
fatiyaa - avatar
+ 7
w=int(input()) h=float(input ()) bmi=(w/(h**2)) while bmi<18.5: print("Underweight") break while bmi>=18.5 and bmi<25.0: print ("Normal") break while bmi>=25.0 and bmi<30.0: print ("Overweight") break while bmi>30.0: print ("Obesity") break Try it.
30th Jan 2022, 9:06 PM
Avrian Shandy
Avrian Shandy - avatar
+ 4
Hanaly Hanalyyev Everyone is here to help. But, before that we need to see your attempt, what you have coded & where you are stuck? Looking at your code, we can help you further. Happy learning!
4th Feb 2021, 2:44 AM
Shivani 📚✍
Shivani 📚✍ - avatar
+ 3
not necessarly... if there is only one short statement in the block, you could have it onelined ;)
20th Mar 2021, 8:25 PM
visph
visph - avatar
+ 3
#your code goes here w=int(input()) h=float(input()) b=w/(h**2) while b<18.5: print("Underweight") break while b>=18.5 and b<25: print("Normal") break while b>25: print("Obesity") break
14th Sep 2021, 2:09 PM
Ali Tanharo
Ali Tanharo - avatar
+ 2
Ask specific question to get help from others .
4th Feb 2021, 12:16 AM
Abhay
Abhay - avatar
+ 2
You must first convert all to float.
3rd May 2021, 10:44 PM
CHUN
+ 2
This is my approach for the problem statement hopefully this helps: Tracking your BMI is a useful way of checking if you’re maintaining a healthy weight. It’s calculated using a person's weight and height, using this formula: weight / height² #my code starts 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")
6th Jan 2022, 6:18 AM
Yukta Patil
+ 1
if I believe OP localisation, he's probably sleeping at now: nigth start just to end in Turkmenistan and he was awake two hours ago ^^
4th Feb 2021, 2:49 AM
visph
visph - avatar
+ 1
If I use range it may be true
4th Feb 2021, 5:51 AM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar
+ 1
you should arrange your line to not get that indent error weight = int(input()) height = float(input()) bmi =float( (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")
1st Oct 2021, 2:40 PM
Ruby Maharjan
Ruby Maharjan - avatar
+ 1
x = int(input()) y = float(input()) if(x/(y**2))<18.5: print ('Underweight') elif (x/(y**2)) <25: print ('Normal') elif (x/(y**2))<30: print ('Overweight') elif (x/(y**2)) > 31: print ('Obesity')
25th Sep 2022, 6:26 AM
pritam jadhav
pritam jadhav - avatar
+ 1
w=int(input()) h=float(input()) bmi=(w/(h*h)) if bmi<=18.5: print("Underweight") if (bmi>=18.5 and bmi<25): print("Normal") if (bmi>=25 and bmi<30): print("Overweight") if bmi>30: print("Obesity")
19th Oct 2022, 9:21 PM
Mirriam
Mirriam - avatar
+ 1
Tracking your BMI is a useful way of checking if you’re maintaining a healthy weight. It’s calculated using a person's weight and height, using this formula: weight / height² The resulting number indicates one of the following categories: Underweight = less than 18.5 Normal = more or equal to 18.5 and less than 25 Overweight = more or equal to 25 and less than 30 Obesity = 30 or more Let’s make finding out your BMI quicker and easier, by creating a program that takes a person's weight and height as input and outputs the corresponding BMI category. answer is weight = int(input()) height = float(input()) if weight/height**2 < 18.5: print ("Underweight") if weight/height**2 >= 18.5 and weight/height**2 < 25: print ("Normal") if weight/height**2 >= 25 and weight/height**2 < 30: print ("Overweight") if weight/height**2 >= 30: print ("Obesity") for all doubt solving contact on this by telegram https://youtu.be/tOWQqOWieE4 by janveer singh
17th Nov 2022, 10:19 AM
Janveer Singh
Janveer Singh - avatar
+ 1
Tracking your BMI is a useful way of checking if you’re maintaining a healthy weight. It’s calculated using a person's weight and height, using this formula: weight / height² The resulting number indicates one of the following categories: Underweight = less than 18.5 Normal = more or equal to 18.5 and less than 25 Overweight = more or equal to 25 and less than 30 Obesity = 30 or more Let’s make finding out your BMI quicker and easier, by creating a program that takes a person's weight and height as input and outputs the corresponding BMI category. answer is weight = int(input()) height = float(input()) if weight/height**2 < 18.5: print ("Underweight") if weight/height**2 >= 18.5 and weight/height**2 < 25: print ("Normal") if weight/height**2 >= 25 and weight/height**2 < 30: print ("Overweight") if weight/height**2 >= 30: print ("Obesity") for all doubt solving contact on this by telegram https://youtu.be/tOWQqOWieE4 by janveer singh
17th Nov 2022, 10:23 AM
Janveer Singh
Janveer Singh - avatar
0
Tracking your BMI is a useful way of checking if you’re maintaining a healthy weight. It’s calculated using a person's weight and height, using this formula: weight / height² The resulting number indicates one of the following categories: Underweight = less than 18.5 Normal = more or equal to 18.5 and less than 25 Overweight = more or equal to 25 and less than 30 Obesity = 30 or more Let’s make finding out your BMI quicker and easier, by creating a program that takes a person's weight and height as input and outputs the corresponding BMI category. Sample Input 85 1.9 Sample Output Normal
4th Feb 2021, 12:19 AM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar
0
show us your coding attempt to get help, and kindly delete you twin post about this ;)
4th Feb 2021, 12:28 AM
visph
visph - avatar
0
My code there
4th Feb 2021, 5:23 AM
Hanaly Hanalyyev
Hanaly Hanalyyev - avatar