Question

In: Computer Science

USE Python 3, please type thanks! Write a Python 3 program to calculate the Body Mass...

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!!

Solutions

Expert Solution

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")


Related Solutions

Write a Python program to determine the body-mass index of a collection of six individuals. Your...
Write a Python program to determine the body-mass index of a collection of six individuals. Your program should include a list of six names. Using a for loop, it should successfully prompt the user for the height in inches and weight in pounds of each individual. Each prompt should include the name of the individual whose height and weight are to be input. It should call a function that accepts the height and weight as parameters and returns the body...
Please write in python Use modular design to write a program that asks the user to...
Please write in python Use modular design to write a program that asks the user to enter his or her weight and the name of a planet. The program then outputs how much the user would weigh on that planet. The following table gives the factor by which the weight must be multiplied for each planet. PLANET CONVERSION FACTOR Mercury 0.4155 Venus 0.8975 Earth 1.0000 Moon 0.1660 Mars 0.3507 Jupiter 2.5374 Saturn 1.0677 Uranus 0.8947 Neptune 1.1794 Pluto 0.0899 The...
Please use Java language! with as much as comment! thanks! Write a program that displays a...
Please use Java language! with as much as comment! thanks! Write a program that displays a frame with a three labels and three textfields. The labels should be "width:", "height:", and "title:" and should each be followed by one textfield. The texfields should be initialized with default values (Example 400, 600, default title), but should be edited by the user. There should be a button (label it whatever you want, I don't care). If you click the button, a new...
Please use Java language! with as much as comment! thanks! Write a program that displays a...
Please use Java language! with as much as comment! thanks! Write a program that displays a frame with a three labels and three textfields. The labels should be "width:", "height:", and "title:" and should each be followed by one textfield. The texfields should be initialized with default values (Example 400, 600, default title), but should be edited by the user. There should be a button (label it whatever you want, I don't care). If you click the button, a new...
PleaSe write a GENERATOR function in Python: how to write it with yield ? XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Thanks...
PleaSe write a GENERATOR function in Python: how to write it with yield ? XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Thanks in advance Write /the/ generator /function/ genAccum(seq, fn), which takes in an iterable and a function fn and yields each accumulated value from applying fn to the running total and the next element. (Note: to convert an iterable into an iterator you use iter(iterable)) ''' >>> add = lambda x, y: x + y >>> mul = lambda x, y: x * y >>>...
Using class, write a program that: Body Mass Index (BMI) calculation - write a program that...
Using class, write a program that: Body Mass Index (BMI) calculation - write a program that takes users' input (weight and Height) and calculates the BMI. If the result is less than 18.5 display "you are underweight", if the result is greater than 18.5 display "you have a normal weight", if the result is greater than 24.9 display "your weight is considered overweight", and the result is greater than 30 display "your weight is considered as obese" (BMI = 703...
Please use the python 3.7 for this assigments Q1 Write a program that accepts the lengths...
Please use the python 3.7 for this assigments Q1 Write a program that accepts the lengths of three sides of a triangle as inputs. The program output should indicate whether or not the triangle is an equilateral triangle. Q2 Write a program that accepts the lengths of three sides of a triangle as inputs. The program output should indicate whether or not the triangle is a right triangle. Recall from the Pythagorean theorem that in a right triangle, the square...
This involves writing a Python program to determine the body-mass index of a collection of six...
This involves writing a Python program to determine the body-mass index of a collection of six individuals. Your program should include a list of six names. Using a for loop, it should successively prompt the user for the height in inches and weight in pounds of each individual. Each prompt should include the name of the individual whose height and weight is to be input. It should call a function that accepts the height and weight as parameters and returns...
Please use Java language with comments! Thanks! Write a program that will display multiple dots move...
Please use Java language with comments! Thanks! Write a program that will display multiple dots move across the Frame and randomly change direction when they hit the edge of the screen. Do this by creating a Dot class and making each dot an object of that class. You may reuse code written in class for this part of the assignment. Create a subclass of the Dot class called PlayerDot that is controlled by the player through keyboard input (arrow keys)...
Please use Python 3 3). Write a function that writes a series of random numbers to...
Please use Python 3 3). Write a function that writes a series of random numbers to a text file named ‘random_number.txt’. Each random number should be in the range of 1 through 500. The function should let the user specify how many random numbers the file will hold. Then write another function that reads the random numbers from the ‘random_number.txt’ file, displays the numbers, and then displays the total of the numbers and the number of random numbers read from...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT