Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this section, we're going to practice using functions and learn how NumPy can be used to write data. Question 10: Create a function to

image text in transcribed

In this section, we're going to practice using functions and learn how NumPy can be used to write data. Question 10: Create a function to calculate body mass index (BMI). BMI has been shown to be moderately correlated with total body fat and is a common measure for determining if a patient may have adverse health outcomes due to weight. Weight (kg) Height (m)2 BMI- where weight is in kg and height in meters (not centimeters) Given this equation, the function should have inputs weight and height, and then return BMI : ### Put your code here Question 11: Using this new function, calculate the bmi of all the children in this data set and store in a new list. Then, use the savetxt() command in NumPy to create a new data files called "bmi_all.txt* that store the bmi calculations. We're using the extension ".txt" to enforce that this is a simple text file that could be read with any text editor. Make a plot of BMI vs age to make sure the values are what you expect them to be : ### Put your code here Question 12: Now, read the text file you just created back into a NumPy array and call this new array bmi2. Plot bmi2 vs the original list of bmi's you created above to make sure the values are the same as before. If everything worked as intended, you should get a straight diagonal line on your plot, which indicates a direct one-to-one mapping between your original values and the values you just read in from your new text file. ### Put your code here Question 13: For adults (age 18-65 years), BMI's in the range of 18.5 to 24.9 kg/m- are considered healthy. A BMI of 25.0 or more is considered overweight. Determine how many adults in this dataset are overweight In this section, we're going to practice using functions and learn how NumPy can be used to write data. Question 10: Create a function to calculate body mass index (BMI). BMI has been shown to be moderately correlated with total body fat and is a common measure for determining if a patient may have adverse health outcomes due to weight. Weight (kg) Height (m)2 BMI- where weight is in kg and height in meters (not centimeters) Given this equation, the function should have inputs weight and height, and then return BMI : ### Put your code here Question 11: Using this new function, calculate the bmi of all the children in this data set and store in a new list. Then, use the savetxt() command in NumPy to create a new data files called "bmi_all.txt* that store the bmi calculations. We're using the extension ".txt" to enforce that this is a simple text file that could be read with any text editor. Make a plot of BMI vs age to make sure the values are what you expect them to be : ### Put your code here Question 12: Now, read the text file you just created back into a NumPy array and call this new array bmi2. Plot bmi2 vs the original list of bmi's you created above to make sure the values are the same as before. If everything worked as intended, you should get a straight diagonal line on your plot, which indicates a direct one-to-one mapping between your original values and the values you just read in from your new text file. ### Put your code here Question 13: For adults (age 18-65 years), BMI's in the range of 18.5 to 24.9 kg/m- are considered healthy. A BMI of 25.0 or more is considered overweight. Determine how many adults in this dataset are overweight

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Different types of Grading?

Answered: 1 week ago

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago