0
Why is it only “Height” set to a type as “float”
Weight is in kg, height is in meters. Note, that height is a float. ABOVE TEXT IS FROM THE BMI TASK IN PYTHON WHAT ABOUT WEIGHT TYPE?
4 Antworten
+ 2
Usually, height is measured in cm. But we need to convert it to meters for calculations. So that's why we are supposed to use float(). Because decimals will be lost if we use int() instead of float().
Mostly weights are integers. It doesn't matter if we use float() for weight :)
+ 1
I’ve set both type as float in the BMI task because not all people have a straight weight like 50, 64 or 83 Kg. and this give the correct answer of your BMI number ❤️
+ 1
like or dislike is awsome! but special dislike would be nice if they left a comment. I’m here to learn and could be very wrong in my Q&A
+ 1
Thank you very much Simba I understand why we use float and special to heights but Personal I would also use float to weight. but nothing was told about weight type in the task. I believe float will give more accurate result and no input error from the user