Answer to Question #231705 in Python for Caleb

Question #231705

Create a program in Python to accept input from clients of their name, weight (in pounds) and height (in inches). Calculate his/her BMI and then display a message telling them the result. Below is the table of BMI for adults:

BMI is calculated by dividing your weight in pounds by your height (in inches) squared and then multiplied by 703. In other words BMI = (W / H2  ) * 703. 

BMI​​​Weight Status

Below 18.5​​Underweight

18.5—24.9​​Normal

25.0—29.9​​Overweight

30.0 and Above​Obese

The program should display for the client a message telling them in which range they are.  Code the program as a loop so that the program will continue to run until there are no more clients. You decide what will end the program


1
Expert's answer
2021-09-01T07:54:25-0400
while True:
    name=input("Enter your name: ")
    W=eval(input("Enter your weight in pounds: "))
    H=eval(input("Enter your height in inches: "))
    H2=H*H
    BMI=(W/H2)*703
    if BMI<18.5:
        print("Underweight")
    elif BMI>=18.5 and BMI<=24.9:
        print("Normal")
    
    elif BMI>=25.0 and BMI<=29.9:
        print("Overweight")
    elif BMI>+30.0:
        print("Obese")
    
    c=input("Continue? y/n")
    if c != 'y':
        break;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS