+ 1
BMI Calculator
Please help me to solve BMI Calculator with python??
85 Answers
+ 22
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')
+ 18
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
+ 10
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')
+ 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.
+ 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!
+ 4
#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
+ 3
not necessarly... if there is only one short statement in the block, you could have it onelined ;)
+ 2
Ask specific question to get help from others .
+ 2
OK, so you wrote the question. Now make your first coding effort and show or link it here.
+ 2
You must first convert all to float.
+ 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")
+ 2
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")
+ 1
If you have no clue how to start I suggest that you revise the tutorial.
+ 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 ^^
+ 1
visph good observation.
+ 1
You need to use if, elif, else etc. and not while.
+ 1
If I use range it may be true
+ 1
You can use "and" to combine conditions.
+ 1
I don't know if giving the complete solution is the best way to teach but there you go.