Question: In python write a function to calculate a person's body mass index (BMI), and a function to categorize this index: Using this for main :

In python write a function to calculate a person's body mass index (BMI), and a function to categorize this index:

In python write a function to calculate a person's body mass index

Using this for main :

def main(): height = float( input("enter height in inches: ") ) weight = float( input("enter weight in pounds: ") ) bodyMassIndex = bmi(height, weight) bmiCat = category(bodyMassIndex) allCats = ['Underweight','Normal','Overweight','Obese'] if bmiCat in allCats: print("BMI is {0:.1f}: {1}".format(bodyMassIndex, bmiCat)) else: print ("Category error:",bmiCat,' must be one of ',allCats)

main()

a. bmi inches, pounds) returns the index using the formula below. b. category (index returns the string category of the index weight (kg) At left is the formula for calculating BMI, given a person's weight in kilograms and BMI height (m height in meters. o Your bmi function starts with the weight in pounds and height in inches, so you must convert to the metric units to calculate BMI. There are 2.20462262 pounds in one kilogram, and there are 39.3700787 inches in a meter. o Your category function is passed a bmi value, and it must return one of the strings in this list ['Underweight Norma Overweight obese in accordance with the following table BMI range Category string Underweight 18.5 Normal 18.5 to just less than 25 Overweight 25 to just less than 30 30 or greater Obese o Here are some sample results from our solution: bash-4.2$ python3 bmi. ...py enter height in inches 69 enter weight in pounds: 175 BMI is 25.8 Overweight -bash-4.2$ python3 bmi.py enter height in inches 64.2 enter weight in pounds: 118.5 BMI is 20.2 Normal

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!