Question: Question 2 : ( 1 5 pts ) ( based on our textbook exercises 5 on page 2 3 9 ) ( Must follow the
Question : ptsbased on our textbook exercises on page Must follow the
instructions below to get full grade
The body mass index BMI is calculated as a person's weight in pounds times
divided by the square of the person's height in inches A BMI in the range of
inclusive, is considered healthy. Write a program that calculates a person's BMI and
prints a personalizedfunny message telling whether they are above, within, or below
the healthy range.
You need to write THREE functions for this program:
First function, you can name heightchangetoincheshf hi which will take
height in BOTH feet AND inches as two formal parameters eg: if the person is feet and
inches tall we will invoke this function as heightchangetoinches then RETURN
no need to print out the height in inches only we did a similar assignment before So for
example, if we call heightchangetoinches it would return
Second function, you can name calculateBMIh w which will take two parameter
values height and weight to calculate the BMI, then RETURN no need to print out this newly
calculated value of BMI.
Last function, we normally name it main which will calluseinvoke TWO functions we
created from previous steps:
It will ask for user to input their height in feet and inches and weight in pounds
height returned from heightchangetoinches with the user's inputs feet and
inches and weight from the user's input will be passed to function calculateBMI as
actual parameters. The returned BMI value will be used to make ifelifelse multiway
decision a BMI in the range inclusive, is considered healthy See an outline of the
program below:
ProjQYourLastName.py
def heightchangetoinches formal paramenters:
you will add more code here to return a new value of height
in inches
def calculateBMI formal paramenters:
you will add more code here to return a new value of BMI
def main:
# get user's inputs of height as feet AND inch and pass them as
actual parameters to heightchangetoinches function
# call heightchangetoinches actual parameters function
here, to return a new value of height in inches only. Assign this
value to some new variable.
# get user's input of weight and pass it as one of the two actual
parameters to calculateBMI function
# call calculateBMI actual parameters from steps above
function, to return a new value of BMI. "Capture" it in some
variable.
#use ifelifelse multiway decision to print out if someone with a certain height
and weight is below, within, or above the BMI range of Make this message funny
in your own way.
main #calling main will start executing the program
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
