Concept explainers
I need help to develop a Python program for the following problem. How can I use the Harris-Benedict equation that estimates the number of calories your body needs to maintain your weight if you do not exercise? Which is called a basal metabolic rate, or BMR.
The calories needed for a woman to maintain her weight are: WBMR = 655 + (4.3 × weight in pounds) + (4.7 × height in inches) − (4.7× age in years)
The calories needed for a man to maintain his weight are: MBMR = 66 + (6.3 × weight in pounds) + (12.9 × height in inches) − (6.8 × age in years).
Write a program that allows the user to input his or her gender, weight in pounds, height in inches (or feet and inches), and age in years.
The program should then display on its output the number of chocolate bars that should be consumed by the individual to maintain one’s weight. Also output the individual's weight, height, age, gender, and BMR.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images
- This is for python, how would i go about doing this?arrow_forwardThe following equation can be used to compute values of y as a function of x: y=be¯ªsin(bx) (0.0012x¹ −0.15x³ +0.075x² +2.5x) where a and b are parameters. (a) Write Python code to compute a vector y for a = 2, b = 5, and x as a vector with values from 0 to π/2 in increments Ax= π/40. (b) Compute the vector z = y² with element-by-element-wise operations. (c) Combine x, y, and zinto a 3-column matrix W.(Hint use np. hstack function) (d) Generate a plot of y and z versus x. Include a title, axis labels, and a legend. For the y versus x curve, format a solid blue line. For the z versus x curve, choose a magenta dashed line. Include grid lines.arrow_forwardThe following equation can be used to compute values of y as a function of x: y=be¯ªsin(bx) (0.0012x¹ −0.15x³ +0.075x² +2.5x) where a and b are parameters. (a) Write Python code to compute a vector y for a = 2, b = 5, and x as a vector with values from 0 to π/2 in increments Ax= π/40. (b) Compute the vector z = y² with element-by-element-wise operations. (c) Combine x, y, and zinto a 3-column matrix W.(Hint use np. hstack function) (d) Generate a plot of y and z versus x. Include a title, axis labels, and a legend. For the y versus x curve, format a solid blue line. For the z versus x curve, choose a magenta dashed line. Include grid lines.arrow_forward
- write a simple python code for vectors:arrow_forwardCan you help me write a python program to do the following: Apply the composite Gaussian Quadrature to approximate the integral (integral shown below) N=10 subintervals. Calculate the absolute error using the exact integral. Repeat your calculation for ?=10, 20, 30 , 40, 50. Observe the error as N gets larger.arrow_forwardwrite a python code for the global error. I am trying to find the difference between the numerically obtained solution and the analytic solution, so I need a code for the global error, which is equal to the difference between the actual solution and the numerically approximated one. the differential equation is dh/dt=(3/5) - (9/20)h with initial condition h(0)=4, and my solution is h(t)=(4/3)+(8/3)e^-(9/20)tarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education