Python Forum
Issue with program not passing to other elif condition
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue with program not passing to other elif condition
#1
Hello

I am new to this forum and programming in general.

I am trying to create BMI calculator. the issue is that no matter what I do the program stops only on the first elif statement (>=18.5 to >=24.9), even if the BMI is higher


code:
print('enter you weight kg')
weight=float(input())
print('enter you height meter')
height=float(input())
BMI=(weight/height**2)

print(BMI)


if BMI<=18.4:                                   
    print('You are underweight')
elif BMI>=18.5 or BMI<=24.9:
    print(' You have Normal weight')
elif BMI >=25 or BMI<=29.9:
    print('You are overweight')
elif BMI>=30 or BMI<=34.9:
    print('You are moderately obese')
elif BMI >=35 or BMI<=39.9:
    print('You are severely obese')
elif BMI>=40:
    print('You are very severely obese')
Thank you
Gribouillis write Nov-18-2021, 10:19 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply


Messages In This Thread
Issue with program not passing to other elif condition - by Abdirahman - Nov-18-2021, 09:27 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Alteryx QS-Passing pandas dataframe column inside SQL query where condition sanky1990 0 1,475 Dec-04-2023, 09:48 PM
Last Post: sanky1990
  else condition not called when if condition is false Sandz1286 10 8,228 Jun-05-2020, 05:01 PM
Last Post: ebolisa
  [HELP] Nested conditional? double condition followed by another condition. penahuse 25 12,408 Jun-01-2020, 06:00 PM
Last Post: penahuse
  How to write a script to execute a program need passing additional input? larkypython 2 3,337 Nov-23-2019, 04:38 AM
Last Post: larkypython
  Whats the right way to refactor this Big if/elif/elif ? pitosalas 1 2,987 Jul-28-2019, 05:52 PM
Last Post: ichabod801
  Facing issue with pyautogui program after PC upgrade Utkarsh29 2 4,049 Jul-15-2019, 05:20 PM
Last Post: Utkarsh29
  if else condition issue mmaz67 4 3,958 Jul-18-2018, 09:02 AM
Last Post: gontajones
  input issue elif jge047 2 4,025 Nov-23-2017, 06:29 AM
Last Post: zykbee
  leap year program issue jashajmera 3 4,870 Feb-04-2017, 11:51 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020