+ 1
I can't find the solution. Please help
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 Answers
+ 3
Your try?
what's your difficulty?
+ 2
I wrote it super!!! super!!!super!!!
+ 1
Djeddi Mohamed Islem your sample code can be simplified further by removing redundant logic. Consider, if bmi<18.5 is false, then logically it is true that bmi>=18.5 so there is no need to test whether it is true. You only need to test the next threshold,
elif bmi<25:
The same reduction can be done for each threshold.
elif bmi<30:
Also, note that Python is case-sensitive. Your cell phone keyboard inserted undesired capitalization that would need correction to make the code run.
+ 1
Thanks for the notes
0
Weight = int(input))
Height = int(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")
#that's the simpliest way possible to solve this