+ 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
5 Respostas
+ 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)
0
show your attempt. Or do it all by yourself.
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
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.
0
Thanks