Question

1. Write a personalized BMI calculator in the form of a function called  bmi_calculator(). This function prompts...

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 )

on python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

'''

Python version : 2.7

Python program to prompt user for their appelation, their first name, their last name, their height in inches, their weight in pounds

and print message stating their bmi index

'''

# function that calculates and returns the bmi for passed weight, w and height, h

def bmi(w, h):

               return ( (w /(h * h)) * 703 )

              

# main function that prompts the user for information, then calls bmi to calculate and display the bmi index

def bmi_calculator():

               appelation = raw_input(' Appelation : ')   

               fname = raw_input(' First name : ')

               lname = raw_input(' Last name : ')

               height = float(raw_input(' Height(in inches) : '))

               weight = float(raw_input(' Weight(in pounds) : '))

              

               print(' BMI Record for %s %s %s' %(appelation,fname,lname))

               height_feet = int(height*0.0833333)

               height_inches = height - (height_feet*12)

               print(' Subject is %d feet %f inches tall and weighs %f pounds' %(height_feet,height_inches,weight))

               print(" The subject's BMI is %f" %(bmi(weight,height)))

              

# call the main function

if __name__ == "__main__":

               bmi_calculator()

#end of program             

Code Screenshot:

2 Python version 2.7 3 Python program to prompt user for their appelation, their first name, their last name, their height in inches, their weight in pounds 4 and print message stating their bmi index 7 # function that calculates and returns the bri for passed weight, w and height, h return (w /(h *h)) * 11 # main function that prompts the user for information, then calls bmi to calculate and display the bmi index 12 주 def bmi-calculator() : 13 appelation = raw input ( Appe!ation fname -rawinput ( First name : lname raw inputLast name ) height -float (raw input Height (in inches)) weightfloat (raw input Weight (in pounds)) - 15 1 6 17 18 print( BMI Record for 욥s 룡s %s %(appelation, fname,lname)) height_feet-int (height*0.0833333) height_inches- height- (height feet*12) print( Subject IS 욜d feet钍inches tall and weighs钍pounds print( The subjects EMI 13钍 % (bmi (weight ,height))) 20 21 23 25 # call the main function % (height-feet,height-inches ,weight)) 26 1f namemain: bmi calculator () 29 #end of program

Output:

D: python myprograms>python bmi_calculator.py Appelation: Ms First name: Michelle Last name Dawn eight(in inches- Weight(in pounds) 100 BMI Record for Ms Michelle Dawn Subject is 5 feet 5.000000 inches tall and weighs 100.000000 pounds The subjects BMI is 16.639053

Add a comment
Know the answer?
Add Answer to:
1. Write a personalized BMI calculator in the form of a function called  bmi_calculator(). This function prompts...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please write this code in C++ Object-Oriented Programming, specify which files are .h, and .cpp, and...

    Please write this code in C++ Object-Oriented Programming, specify which files are .h, and .cpp, and please add comments for the whole code. Include a class diagrams, and explain the approach you used for the project and how you implemented that, briefly in a few sentences. Please note the following: -Names chosen for classes, functions, and variables should effectively convey the purpose and meaning of the named entity. - Code duplication should be avoided by factoring out common code into...

  • You will be writing a simple Java program that implements an ancient form of encryption known...

    You will be writing a simple Java program that implements an ancient form of encryption known as a substitution cipher or a Caesar cipher (after Julius Caesar, who reportedly used it to send messages to his armies) or a shift cipher. In a Caesar cipher, the letters in a message are replaced by the letters of a "shifted" alphabet. So for example if we had a shift of 3 we might have the following replacements: Original alphabet: A B C...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT