+ 1

Python Beginner Question

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 My Code: height = int(input()) weight = (input()) print (weight/ (height**2)) What's wrong?

26th Jan 2022, 4:08 PM
Ogunseye Sodiq Akolade
Ogunseye Sodiq Akolade  - avatar
3 Answers
+ 5
weight needs to be converted to float and you need to give output as in the task description
26th Jan 2022, 4:14 PM
Lisa
Lisa - avatar
+ 5
Ogunseye Sodiq Akolade Read the task description again. You have to print text based on condition. You just printed BMI value.
26th Jan 2022, 4:31 PM
AÍąJ
AÍąJ - avatar
+ 2
After calculating this, weight/height**2 You have to check if the calculated value is less than 18.5 (if it is then print 'Underweight')... If it is more than or equal to 18.5 and less than 25 (if it is then print 'Normal') ...And so on (as written in the question description... Note: mind the cases!! I meant don't print 'underweight' in exchange of 'Underweight'. It would be taken as wrong, you have to output Underweight (see the capitalised 'u')...and do the same for all...
26th Jan 2022, 4:53 PM
NEZ
NEZ - avatar