BMI calculator not working please help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

BMI calculator not working please help

#your code goes here wieght = int(input()) hieght = float(input()) reslut = wieght / float ( hieght ** 2) if (reslut < 18.5): print ("Underweight") elif (reslut >= 18.5) and (wieght < 25.0): print ("Normal") elif (reslut >= 25.0) and (wieght < 30.0): print ("Overweight") elif (reslut > 30.0): print ("Obesity")

16th Mar 2021, 7:22 AM
Nirmal
Nirmal - avatar
8 Answers
+ 1
check your elif conditions again and what you're comparing them to on one side of the "and" versus the other side.
16th Mar 2021, 7:37 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Simba no needs of higher precedence as wieght*wieght is wraped inside parenthesis...
16th Mar 2021, 9:14 AM
visph
visph - avatar
0
first 2 test passed and other three failed please help
16th Mar 2021, 7:23 AM
Nirmal
Nirmal - avatar
0
Nirmal did you have solved it now? if not, you must check for 'reslut' less than something rather than 'wieght' ^^
16th Mar 2021, 8:14 AM
visph
visph - avatar
0
visph no I didn't
16th Mar 2021, 10:20 AM
Nirmal
Nirmal - avatar
0
Nirmal you didn't what?
16th Mar 2021, 10:22 AM
visph
visph - avatar
0
if you didn't yet solve your problem, follow my first post advice ;)
16th Mar 2021, 10:23 AM
visph
visph - avatar
0
visph oh my god thanks man I am being a absolute dumm thanks . I just forgot that result variable 😅
16th Mar 2021, 11:12 AM
Nirmal
Nirmal - avatar