Question: python code plz Objectives The objectives of this lab are: - to show how functions can make programs easier to write and understand - to

python code plz  python code plz Objectives The objectives of this lab are: -
to show how functions can make programs easier to write and understand
- to gain understanding of how to use functions someone else has
written - to gain understanding of function arguments - to gain understanding

Objectives The objectives of this lab are: - to show how functions can make programs easier to write and understand - to gain understanding of how to use functions someone else has written - to gain understanding of function arguments - to gain understanding of function retum values Description You wili create a program to compute the Basic Metabolic Rate of a person, which is the amount of calories your body needs each day II sustain its basic vital functions. This is similar to your project, but this time, we have provided a function that will calculate the BMR based on a persoris age, sex, height, and weight. So all your program needs to do is prompt the user for their age, sex, weight in pounds, and height in inches, then call the function with those arguments. The function will return the BMR, so you can then print out the message of the person's BMR Your program will prompt the user for weight in pounds, height in inches, age in years, sex as m or f, in that order. You may use whatever prompts you want and feel are appropriate. Then, once you have all of the information; you need to call the function called CoaputeluR. The arguments that need to be sent to the function are the age, sex, heighis, and weight, in that order You can assume that all of the numerif inputs are integers, that is, no fractional or decimal parts. The function ComputeBMR is included as an external file to the zyLab, but you do not need to be able to see it or its code in ordes to use the function. You can treat the function as a black box that you send the proper arguments to, and it will return the proper yalue to you vou need to tell Python that you are using a function from an external fle, similar to how you need to tell it when you are using a function from the math or random libraries. You will need to include the following line as the beginning of your program Vour program will prompt the user for weight in pounds, height in inches, age in years, sex as ' m or I, in that order. You may use whatever prompts you want and feel are appropriate. Then, once you have all of the information, you need to call the function called CopputeBali. The arguments that need to be sent to the function are the age, sex, height, and weight, in that order You can assume that all of the numeric inputs are integers, that is, no fractional or decimal parts. The function ComputeBMR is included as an external file to the zyLab, but you do not need to be able to see it or its code in order to use the function. You can treat the function as a black box that you send the proper arguments to, and it will return the proper value to you. You need to tell Python that you are using a function from an external file; similar to how you need to tell it when you are using a function frem the math or random libraries. You will need to include the following line at the beginning of your program: trom HMREunetion impott ComputeBMR This is telling Python that you are going to be using the function Computebur which can be found in the Python file Bukrfiunc tion. When you import a function this way, you do not need to do anything special to indicate where it came from, just call the function as if it exiats as pat of Python. For example, ConputeByR (25, ' f ', 62, 130) would call the function with age 25, female, height of 62 inches, and weight of 130 pounds. Once you receive the value back from the function, you need to print out a message similar to the following (depending on the inputes). Ae 68 inches tal1 and weighing 155 pounds, at your age you need 1542.92 calories per day. At 63 inches tall and weighing 140 pounds, at your age you need 1384.48 calories per day. PMR - hhould be printed to 2 decimal places, even though the function may be retuming a float value with more or less than 2 decimal This is telling Python that you are going to be using the function conputeBur which can be found in the Python file Bxerfinction. When you import a function this way, you do not need to do anything special to indicate where it came from, just call the function as if it exists as part of Python. For example, CooputeBYR (25; ' f', 62, 130) would call the function with age 25 , female, height of 62 inches, and weight of 130 pounds Once you receive the value back from the function, you need to print out a message similar to the following (depending on the inputs) At: 68 Inches ta11 and weighing 155 pounds, at your age you need 1542.92 calortes per day. At 63 inches tal1 and woighing 140 pounds, at, your age you need 1384.46 caloriea per day. BMR should be printed to 2 decimal places, even though the function may be returning a foat value with more or less than 2 decimat places. NOTE You do not need to handle any error checking. That is done within the function. One of the test cases illustrates this but you do not. need to do anything in your code to handle errors 6.12.1: REQUIRED - Lab 6D: using functions others have written 0/25 main.py Losd default template main.py

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!