0
I am facing difficulties in making BMI reader
height = int(input(enter your height in inches:)) weight = int(input(enter your weight in kg:)) def BMI(height, weight): bmi = weight/(height**2) if (bmi<18.5): return 'Underweight', bmi if (bmi>=18.5 and bmi<25): return 'Normal', bmi if (bmi>=25 and bmi<30): return 'Overweight', bmi if (bmi>30): return 'Obesity', bmi quote, bmi = BMI(height, weight) print('your bmi is:{} and you are:{}'.format(bmi,quote))
1 Réponse
+ 3
# Hi, Ajay Parihar !
# You can start to comparing to this one:
weight = float(input("enter your weight in kg: "))
print(weight)
height = float(input("enter your height in inches: "))
print(height)
print()
def BMI(weight, height):
bmi = weight / (height ** 2)
if bmi < 18.5:
return 'Underweight', bmi
elif bmi >= 18.5 and bmi < 25:
return 'Normal', bmi
elif bmi >= 25 and bmi < 30:
return 'Overweight', bmi
else:
return 'Obesity', bmi
quote, bmi = BMI(weight, height)
print(f"your bmi is: {bmi:.2f} and you are: {quote}")