Question
1. Update this BMI program to show the weight status as follows: If the BMI result is less than 18.5, add a message that the
1.Update this BMI program to show the weight status as follows:
If the BMI result is less than 18.5, add a message that the patient is underweight
If the BMI result is equal to or greater than 18.5 and less than 25, print a message that the patient has a normal or healthy weight
If the BMI result is equal to or greater than 25 and less than 30, add a message that the patient is overweight
If the BMI result is equal to or greater than 30, add a message that the patient is obese
Here is a table of showing some example results you should be able to get:
BMI | Should Give: |
18.4 | Underweight |
18.5 | Normal |
24.9 | Normal |
25.0 | Overweight |
29.9 | Overweight |
30 and 50 | Obease |
Here is the program you need to copy and modify:
# BMI calculation pt_id = input("Enter the patient's name: ") weight = float(input("Enter the patient's weight in Kg: ")) height = float(input("Enter the patient's height in cm:")) bmi = weight/ (height / 100) ** 2 print( 'Patient ' + pt_id + ' with weight ' + str(weight) + ' kg' + ' and height ' + str(height) + ' cm' + ' has a Body Mass Index(BMI) of ' + str(bmi) )
Here is what I have so far, not sure how to change the if statement that would work for this code:
pt_id = input("Enter the patient's name: ") weight = float(input("Enter the patient's weight in Kg: ")) height = float(input("Enter the patient's height in cm:")) bmi = weight/ (height / 100) ** 2 print( 'Patient ' + pt_id + ' with weight ' + str(weight) + ' kg' + ' and height ' + str(height) + ' cm' + ' has a Body Mass Index(BMI) of ' + str(bmi) ) if bmi < 18.5: print("Patient", pt_id, "is underweight") else: if bmi >= 18.5: print("Patient", pt_id, "has a normal or health weight") else: if bmi < 25: print("Patient", pt_id, "has a normal or health weight") else: if bmi >= 25: print("Patient", pt_id, "is overweight") else: if bmi < 30: print("Patient", pt_id, "is overweight") else: if bmi >= 30: print("Patient", pt_id, "is obease") print("The program is completed, thank you!")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started