+ 7
Hello everyone. Help build a BMI calculator . Please
27 Antworten
+ 5
weight=int(input())
height=float(input())
BMI=weight/(height/100)**2
if bmi<18.5:
print("Underweight")
elif bmi>=18.5 and bmi<25:
print("Normal")
elif bmi>=25 and bmi<30:
print("Overwight")
else:
print("Obesity")
+ 12
Post your attempt first
+ 9
Thanks 🔥🔥👍👍😊😊
+ 9
#your code goes here
weight = int(input());
height = float(input());
bmi = weight/float(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')
This will works
+ 7
Height=float(input())
Weight=float(input())
x= "BMI"
x = Height/Weight ** 2
if x<18.5:
print("Underweight")
elif x>=30:
print("Obesity")
elif x>=18 and x<25:
print("Normal")
elif x>=25 and x<30:
print("Overweight")
+ 6
Thank you all 😊😊😊
+ 5
Thank you bro😊😊👍🔥
+ 4
Thank you sister 😊😊😊
+ 3
Use the formula : BMI = (weight in kg) / (square of the height in m)
+ 3
∆BH∆Y you can't write "height in m**2" because the units of height are metres and not square metres.
+ 3
∆BH∆Y by writing (height in m)**2 we signify that we're squaring the value of height expressed in units of metres.
If you write (height in m**2) you're saying that the units of height are square metres, which is wrong.
+ 3
# your code starts here ...
Weight = int(input());
Height = float(input());
Bmi = Weight / (Height ** 2);
if Bmi < 18.5:
print("Underweight")
elif 18.5 <= Bmi < 25:
print("Normal")
elif 25 <= Bmi < 30:
print("Overweight")
else:
if Bmi >= 30:
print("Obesity")
#No biggie!All programs create bugs.Go back and squash them .
+ 2
∆BH∆Y by "(height in m) **2", what I meant was the square value of the height in metres. I have rephrased my answer if it confused you.
+ 2
∆BH∆Y no problem 👍
+ 2
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')
else:
print('Obesity')
+ 1
Most welcome bro🙏👍
+ 1
🥇🏆🥇💯💯👍🏻👍🏻
+ 1
#your code goes here
weight=int(input())
height=float(input())
BMI=weight/(height*height)
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")
+ 1
hello, question here is how i wrote my code:
weight = int(input())
height = float(input())
x = (weight/(height**2))
if x < 18.5:
print ("Underweight")
elif x >= 18.5 and x < 25:
print("Normal")
elif x>= 25 and x < 30:
print("Underweight")
elif x >=30:
print("Obesity")
but this code did not pass the third test case. can someone explain why?
i am seeing some codes wrote their BMI differently than mine as well
mine:x = (weight/(height**2))
others:BMI=weight/(height*height), Bmi = Weight / (Height ** 2);, bmi = float(weight/(height**2))
can someone explain the difference?
+ 1
weight = int(input())
height = float(input())
x = "BMI"
i = weight/height**2
if i < 18.5:
print("Underweight")
elif i > 18.5 and i < 25:
print("Normal")
elif i >= 25 and i < 30:
print("Overweight")
else:
print("Obesity")