Here weight is in kg, and height is in meter. Height is in float. PLEASE HELP ME. | Sololearn: Learn to code for FREE!
+ 2

Here weight is in kg, and height is in meter. Height is in float. PLEASE HELP ME.

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

30th Mar 2021, 5:53 PM
Yogesh Gour
Yogesh Gour - avatar
5 Réponses
+ 2
Don't use int() for height, only height = float(input()) Don't use print to calculate x, only x = weight / height ** 2 Read the definition of categories again, you have to change "<=" to only "<" two times. Also you can delete the first two lines. And last elif can be else (no condition needed)
30th Mar 2021, 7:03 PM
Benjamin J√ľrgens
Benjamin J√ľrgens - avatar
0
show your attempt. Or do it all by yourself.
30th Mar 2021, 5:54 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
weight = "kilogram" height = "meters" weight=int(input()) height=int(float (input ()) x = print(weight/(height)**2) if x < 18.5: print ("Underweight") elif (x>=18.5 and x<=25): print ("Normal") elif (x>=25 and x<=30): print ("Overweight") elif (x>=30): print("Obesity") Here is my attempt
30th Mar 2021, 6:03 PM
Yogesh Gour
Yogesh Gour - avatar
0
It seems that you have a print statement for a variable and line 4 had a missing close parentheses. Also I will update my answer everytime I inspected your attempt.
30th Mar 2021, 6:06 PM
Dino Wun (Use the search bar plz!)
Dino Wun (Use the search bar plz!) - avatar
0
Thanks
30th Mar 2021, 6:07 PM
Yogesh Gour
Yogesh Gour - avatar