0
Why do the variables need to be switched?
When I ran this code with the 'height' and 'weight' variables like below, it wouldn't work...but when I switched it so 'weight' went first, the code worked. Why is that? height = float(input()) weight = float(input()) BMI = weight/(height*height) if BMI < 18.5: print ("Underweight") elif BMI >= 18.5 and BMI < 25: print ("Normal") elif BMI >= 25 and BMI < 30: print ("Overweight") elif BMI >=30: print ("Obesity")
1 Réponse
+ 6
say, for example, you entered: 60 and 150 for your input:
60 / (150 * 150) = .0027
AND
150 / (60 * 60) = .042
would be the bmi depending on which was supplied first. And as you can see, the have very differnt solutions. Also, input is specifically given in an order for these challenges.