+ 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 ")
9 Answers
+ 2
Don't include spaces before and after output words..
+ 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.
+ 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.
+ 2
Hussain Ali Nawid one of the output words does not match Code Coach's expected capitalization.
+ 2
Hussain Ali Nawid if you would like more help, then share your latest code.
+ 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 ")
+ 1
Thanks I debuged
0
Thanks from all of you for replying me.
But I can not pass that.