In: Computer Science
USE Python 3, please type thanks!
Write a Python 3 program to calculate the Body Mass Index (BMI) of a person if they enter their weight and their height to your program. Check out the formula here:
http://www.freebmicalculator.net/calculate-bmi.php
Your program should first print "Body Mass Index Calculator"
The program will then ask the user if they want to enter Metric Units or English Units.
Using the appropriate formula (see link above) calculate their BMI.
Depending on their BMI show their body type (Underweight, Normal Weight, Overweight or Obese).
For BMI ranges see the following link:
http://www.freebmicalculator.net/healthy-bmi.php
HINT: to find the appropriate body type you might want to study this program:
score = input("Enter score: ") score = int(score) if score >= 80: grade = 'A' elif score >= 70: grade = 'B' elif score >= 55: grade = 'C' elif score >= 50: grade = 'Pass' else: grade = 'Fail' print ("\n\nGrade is: " + grade)
Include in the comments a set of test runs to show that your program is correct.
Double check your results by testing using the same values in your program as in the following online BMI calculator:
http://www.nhlbi.nih.gov/health/educational/lose_wt/BMI/bmicalc.htm
Thank you for your help!!
print ("Body Mass Index Calculator") unit=(input("Please enter which unit you would like to use (Metric Units or English Units): ")) bmi = 0 if unit == "Metric Units": height = float(input("Please enter your height in meters: ")) weight = float(input("Please enter your weight in kilograms: ")) bmi = weight / height ** 2 else: height = float(input("Please enter your height in inches: ")) weight = float(input("Please enter your weight in pounds: ")) bmi = weight * 703 / height ** 2 print("BMI =",bmi) if(bmi<18.5): print("Underweight") elif(bmi<25): print("Normal weight") elif(bmi<30): print("Overweight") else: print("Obesity")