0
Help me please
i'm going through python and i've been sitting on the bmi calculator level for almost a day, can anyone help me, here is my code weight = int(iput()) growth = int(input()) if weight < 18.5: print("Underweight") if 18.5 < weight < 25: print("Normal") if 25 < weight < 30: print("Overweight") if 30 < weight: print("Obesity")
2 Answers
+ 4
In addition to the accepted answer, you should convert your input to a float rather than an int so that the decimals don't get removed.
Also, Python does allow expressions such as 18.5 < weight < 25, but it's very uncommon in other languages and some people consider it bad practice, so I agree that the "and" operator should be used instead.