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

python Bmi calculator

Python learners plz help to Python model quiz final Bmi calculator solution

2nd Dec 2021, 3:43 PM
Bhupal Raut
10 Answers
+ 4
Check this out: #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")
2nd Dec 2021, 4:27 PM
Arun Jamson
Arun Jamson - avatar
+ 2
https://code.sololearn.com/c2s7cmp3Ug4N/?ref=app Not sure about your error but I think is indentation. Your print statements should be indented to only execute when the condition is true. See my code.
2nd Dec 2021, 4:28 PM
Lebi
+ 1
BMI Calculator 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 Weight is in kg, height is in meters. Note, that height is a float.
2nd Dec 2021, 3:43 PM
Bhupal Raut
+ 1
I tried this way but not working weight = int(input()) height = float(input()) BMI = weight / (height * height) 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")
2nd Dec 2021, 3:46 PM
Bhupal Raut
+ 1
I thought both weight and height were suppose to be float when I did this challenge.
3rd Dec 2021, 5:17 PM
Lebi
0
@Lebi thank you so much but there why weight is in float? while it says height is in only float
3rd Dec 2021, 2:37 PM
Bhupal Raut
- 1
Whats your error? Are your code running properly? Is that actual code you are trying? it is not idented properly... so errors. save in playground and share link here...
2nd Dec 2021, 4:13 PM
Jayakrishna 🇮🇳
- 1
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') elif bmi > 30: print('Obesity')
27th Jul 2022, 10:01 PM
Alexander Le
Alexander Le - avatar
- 1
w=float(input()) h=float(input()) B=w/(h**2) if B<18.5: print("Underweight") elif B>=18.5 and B<25: print("normal") elif B>=25 and B<30: print("Overweight") elif B>=30: print("Obesity")
3rd Nov 2022, 8:21 AM
SHREEMAN R
SHREEMAN R - avatar
- 1
w=float(input()) h=float(input()) B=w/(h**2) if B<18.5: print("Underweight") elif B>=18.5 and B<25: print("normal") elif B>=25 and B<30: print("Overweight") elif B>=30: print("Obesity") to solve all 5 cases
3rd Nov 2022, 8:22 AM
SHREEMAN R
SHREEMAN R - avatar