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.
BMIWeight Status
Below 18.5Underweight
18.5—24.9Normal
25.0—29.9Overweight
30.0 and AboveObese
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
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;
Comments
Leave a comment