What is this code need to solve "BMI calculator problem"? Test case#1 and #2 are green but other test cases are red. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is this code need to solve "BMI calculator problem"? Test case#1 and #2 are green but other test cases are red.

weight = int(input()) height = float(input()) BMI = (weight / height**2) if BMI < 18.5: print('Under weight') if 18.5 <= BMI < 25: print('Normal weight') if 25 <= BMI < 30: print('Heavy Weight') if BMI >30: print('Obesity')

20th Jun 2021, 3:38 AM
Myo Min Htet Aung
Myo Min Htet Aung - avatar
6 Answers
+ 6
your output strings are incorrect... test expect exactly what's stated in description: Underweight Normal Overweight Obesity
20th Jun 2021, 3:44 AM
visph
visph - avatar
+ 3
Myo Min Htet Aung only your last string is correct: Normal should not be followed by weight, and 2 others must not have space before weight (and be all lowercase except first char uppercase -- word capitalization)
20th Jun 2021, 4:24 AM
visph
visph - avatar
+ 2
Also should be Overweight, not Heavy Weight
20th Jun 2021, 4:24 AM
visph
visph - avatar
+ 1
visph Thanks,Sir! I get it😁😁
20th Jun 2021, 4:27 AM
Myo Min Htet Aung
Myo Min Htet Aung - avatar
0
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
20th Jun 2021, 3:40 AM
Myo Min Htet Aung
Myo Min Htet Aung - avatar
0
visph Sir..Can you follow me back? Pls
20th Jun 2021, 4:30 AM
Myo Min Htet Aung
Myo Min Htet Aung - avatar