BMI_num = 21
if BMI_num <= 18.5:
BMI_title = 'Underweight'
print ('Results . . . ')
print ('Your BMI is: ', BMI_num , '--' , BMI_title)
elif 18.5 > BMI_num >= 24.9:
BMI_title = 'Normal'
print ('Results . . . ')
print ('Your BMI is: ', BMI_num , '--' , BMI_title)
elif 25 >= BMI_num >= 29.9:
BMI_title = 'Overweight'
print ('Results . . . ')
print ('Your BMI is: ', BMI_num , '--' , BMI_title)
elif BMI_num < 30:
BMI_title = 'Obese'
print ('Results . . . ')
print ('Your BMI is: ', BMI_num , '--' , BMI_title)
>Solution :
You need to replace > with <. Comparisons such as 18.5 > BMI_num >= 24.9 will always be False as no number can simultaneously be less than 18.5 and more than 24.9.
You also may want to consider that when BMI_num is 24.95 or 29.95 no code will be run.
Also you can reduce some code duplication by printing after.
if BMI_num <= 18.5:
BMI_title = 'Underweight'
elif 18.5 < BMI_num < 25:
BMI_title = 'Normal'
elif 25 <= BMI_num <= 29.9:
BMI_title = 'Overweight'
elif BMI_num < 30:
BMI_title = 'Obese'
print ('Results . . . ')
print (f'Your BMI is: {BMI_num} -- {BMI_title}')