+ 1

What is wrong with this codes?

#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 BMI >= 30: print (" Obesity ")

23rd Dec 2022, 4:24 AM
Hussain Ali Nawid
Hussain Ali Nawid - avatar
9 Answers
+ 2
Don't include spaces before and after output words..
30th Dec 2022, 4:11 PM
Jayakrishna 🇼🇳
+ 7
The formula for calculating BMI is incorrect. BMI should be calculated as weight (in kilograms) divided by height (in meters) squared, not weight divided by height multiplied by 2. The correct formula would be: BMI = weight / (height * height). The else statement at the end of the code is missing a condition. It should be else: instead of else BMI >= 30:. There are no indentations in the code. Proper indentation is important in Python as it helps to define the structure of the code and makes it easier to read.alsohere is no output for the case where the BMI is between 25 and 30, inclusive. This can be fixed by adding an additional elif statement with the condition BMI >= 25 and BMI < 30.
23rd Dec 2022, 4:44 AM
Sadaam Linux
Sadaam Linux - avatar
+ 2
The formula given in the task is : Bmi = weight / height ** 2 #height^2 Use this farmula, and Don't put any spaces before and after output text.
23rd Dec 2022, 8:18 AM
Jayakrishna 🇼🇳
+ 2
Hussain Ali Nawid one of the output words does not match Code Coach's expected capitalization.
23rd Dec 2022, 9:07 AM
Brian
Brian - avatar
+ 2
Hussain Ali Nawid if you would like more help, then share your latest code.
30th Dec 2022, 3:55 PM
Brian
Brian - avatar
+ 1
Here is my latest code: #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 ") elif BMI >= 30: print (" Obesity ")
30th Dec 2022, 4:09 PM
Hussain Ali Nawid
Hussain Ali Nawid - avatar
+ 1
Thanks I debuged
30th Dec 2022, 4:15 PM
Hussain Ali Nawid
Hussain Ali Nawid - avatar
0
Thanks from all of you for replying me. But I can not pass that.
30th Dec 2022, 3:15 PM
Hussain Ali Nawid
Hussain Ali Nawid - avatar