0

Alternate solution

Want to know if there is any other way of solving the BMI calculator problem apart from following: w = int(input()) ht = float(input()) BMI = (w/(ht**2)) if BMI < 18.5: print('Underweight') elif BMI >= 18.5 and BMI < 25: print('Normal') elif BMI >= 25 and BMI < 30: print('Overweight') else: print('Obesity')

16th May 2021, 8:57 PM
Raghav Sharma
Raghav Sharma - avatar
8 Respostas
+ 2
the only thing that can be used is this option: 18.5 <= BMI < 25
16th May 2021, 9:02 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Thanks, i didnt know relational operators can be used like this too
16th May 2021, 9:03 PM
Raghav Sharma
Raghav Sharma - avatar
+ 1
Ну это уж слишком заморочено 😁👍
16th May 2021, 9:58 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
нет предела совершенству ☺️
16th May 2021, 10:12 PM
Solo
Solo - avatar
0
Hi! I think no, this is good solution.
16th May 2021, 8:59 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Just try it in your program
16th May 2021, 9:04 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
It works 😏
16th May 2021, 9:22 PM
Raghav Sharma
Raghav Sharma - avatar