0
Can anyone help me to solve this python problem
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² The resulting number indicates one of the following categories: Underweight = less than 18.5 Normal = more or equal to 18.5 and less than 25 Overweight = more or equal to 25 and less than 30 Obesity = 30 or more Let’s make finding out your BMI quicker and easier, by creating a program that takes a person's weight and height as input and outputs the corresponding BMI category. Sample Input 85 1.9 Sample Output Normal
5 ответов
+ 2
Please check spellings and op as per the constraints (i.e Caps etc)
w=float(input())
h=float(input())
bmi=w/(h**2)
if bmi<18.5:
# print(bmi)
print('Underweight\n')
elif bmi>=18.5 and bmi<25:
# print(bmi)
print('Normal')
elif bmi>=25 and bmi<30:
# print(bmi)
print('Overweight')
else:
print('Obesity')
0
#your code goes here
#w=float(input('enter weight\n'))
#h=float(input("enter hieght\n"))
w=52
h=1.85
bmi=float(w/(h**2))
if bmi<18.5:
# print(bmi)
print('Underweight\n')
elif bmi>=18.5 and bmi<25:
# print(bmi)
print('normal')
elif bmi>=25 and bmi<30:
# print(bmi)
print('overwieght')
elif bmi>=30:
print('Obesity')
I tried this but I clear only 1 test with this code other test cases are not cleared.
0
Some words need to be capital:
overweight -> Overweight
normal -> Normal
The test cases use input() to work. Each cases make different input, so w and h should be inputted. Uncomment the 1st and 2nd line and remove the 3rd and 4th line.
0
Thanks to all
- 1
No hws pls 🙂