1. Write a personalized BMI calculator in the form of a function called bmi_calc
ID: 670184 • Letter: 1
Question
1. Write a personalized BMI calculator in the form of a function called bmi_calculator(). This function prompts the user for their appelation, their first name, their last name, their height in inches, their weight in pounds, and prints a message of the form:
BMI Record for _APPELATION _FIRSTNAME _LASTNAME:
Subject is _X feet _Y inches tall and weighs _Z pounds.
The subject's BMI is _B.
(The words preceded by _ are replaced with the input provided by the user.) Your solution must use a function call to bmi function from question 5.
answer for q5
def bmi(w, h):
return ( (w /(h * h)) * 703 )
(this program is writen using python. I had posted similar question on this, but the answer doesn't work!)
Explanation / Answer
def bmi(w, h):
return ( (w /(h * h)) * 703 )
fname=raw_input("Enter first name: ")
lname=raw_input("Enter last name: ")
feet=int(raw_input("enter number of feet: "))
inch=int(raw_input("enter number of inches: "))
w=float(raw_input("Enter the weight in pounds: "))
h=feet*12+inch
print "BMI",bmi(w,h)
I have checked it it works fine convert the feet to inches
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.