Alternate solution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
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
8 Answers
+ 2
the only thing that can be used is this option: 18.5 <= BMI < 25
16th May 2021, 9:02 PM
Yaroslav Vernigora
+ 1
Thanks, i didnt know relational operators can be used like this too
16th May 2021, 9:03 PM
Raghav Sharma
+ 1
Ну это уж слишком заморочено 😁👍
16th May 2021, 9:58 PM
Yaroslav Vernigora
+ 1
нет предела совершенству ☺️
16th May 2021, 10:12 PM
Solo
0
Hi! I think no, this is good solution.
16th May 2021, 8:59 PM
Yaroslav Vernigora
0
Just try it in your program
16th May 2021, 9:04 PM
Yaroslav Vernigora
0
It works 😏
16th May 2021, 9:22 PM
Raghav Sharma
16th May 2021, 9:35 PM
Solo