Question

+ Run C Code IMPORTANT: • Run the following code cell to create the input file, biostats.csv, which you will be using later.character. Question 1 55 points Consider a CSV file named biostats.csv that has Name, Sex, Age, Height, and weight data in co• Write a Python function called bmi( bio_data ) that takes the data read from the input CSV file and returns a list of the bYOU MUST WRITE ALL YOUR CODE IN THE FOLLOWING CODE CELL In [ ]: # YOUR CODE HERE pass def num_males( bio_data ): See above spSee above specs # YOUR CODE HERE pass def bmi( bio_data ): write your function according to the specifications given in the q

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

count=0
def num_males(bio_data):
for i in bio_data['Sex']:
if i=='M':
count+=1
  
print("Number of Males=",count)
count=0

def num_females(bio_data):
for i in bio_data['Sex']:
if i=='F':
count+=1

print("Number of Females=",count)
count=0

def average_age(bio_data):
avg=round(sum(bio_data['Age'])/len(bio_data['Age']),2)
print("Average of the age given =",avg)

def average_weight(bio_data):
avg=round(sum(bio_data['Weight'])/len(bio_data['Weight']),2)
print("Average of the Weight given =",avg)

def average_height(bio_data):
avg=round(sum(bio_data['Height'])/len(bio_data['Height']),2)
print("Average of the Height given =",avg)

def bmi(bio_data):
h=[]
w=[]
bm=[]
h=bio_data['Height']
w=bio_data['Weight']
for i in range(0,len(h)):
bm.append(round( ((w[i]/h[i])*703),1))
print(bm)


  

Add a comment
Know the answer?
Add Answer to:
+ Run C Code IMPORTANT: • Run the following code cell to create the input file,...
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 solve the following, please type out the code, and do not hand write because its...

    Please solve the following, please type out the code, and do not hand write because its hard to read. I would greatly appreciate it. (JAVA) Problem 1 In a class called H1P1, write a method called bmiOne that takes as arguments a mass in kilograms (a double) and a height in meters (also a double), and returns the body mass index (or BMI) for the given data. If we have mass -m kg and height-h meters, then BMI = Write...

  • IT Java code In Lab 8, we are going to re-write Lab 3 and add code...

    IT Java code In Lab 8, we are going to re-write Lab 3 and add code to validate user input. The Body Mass Index (BMI) is a calculation used to categorize whether a person’s weight is at a healthy level for a given height. The formula is as follows:                 bmi = kilograms / (meters2)                 where kilograms = person’s weight in kilograms, meters = person’s height in meters BMI is then categorized as follows: Classification BMI Range Underweight Less...

  • Python solutions please. correct code for Thumbs Up. Calculate the BMI of a person using the...

    Python solutions please. correct code for Thumbs Up. Calculate the BMI of a person using the formula: BMI = ( Weight in Pounds ((Height in inches ) x (Height in inches ))) x 703 Assign the value to the variable bmi. Assume the value of the weight in pounds has already been assigned to the variable w and the value of the height in inches has been assigned to the variable h. Assume that print_error_description is a function that expects...

  • 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...

  • Jupyter code (PYTHON) True error Write a function called trueError that takes the following inputs: •...

    Jupyter code (PYTHON) True error Write a function called trueError that takes the following inputs: • X, the new value • Xtrue, the previous value And returns the following output: • error, the calculated relative error The formula for the relative error is shown below: errue = 11100% In (): def trueError(x,xtrue): # YOUR CODE HERE raise Not ImplementedError() In (): # You can call and test your function here # YOUR CODE HERE raise Not ImplementedError()

  • According to Wikipedia , a comma-separated values (CSV) file is a delimited text file that uses...

    According to Wikipedia , a comma-separated values (CSV) file is a delimited text file that uses a comma to separate values. A CSV file stores tabular data (numbers and text) in plain text. Each line of the file is a data record. Each record consists of one or more fields, separated by commas. The use of the comma as a field separator is the source of the name for this file format. A company has text data that is not...

  • FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width,...

    FOR C++ PLEASE Create a class called "box" that has the following attributes (variables): length, width, height (in inches), weight (in pounds), address (1 line), city, state, zip code. These variables must be private. Create setter and getter functions for each of these variables. Also create two constructors for the box class, one default constructor that takes no parameters and sets everything to default values, and one which takes parameters for all of the above. Create a calcShippingPrice function that...

  • I have this C program that calculates an input and converts it to a BMI calculation....

    I have this C program that calculates an input and converts it to a BMI calculation. Any idea how this would look as an LC3 program? I'm taking an LC3 programming class next semester and want an idea of what this code would even translate to, just trying to get a head start. I'm more so curious on how to get user input in a LC3 program, then I can try myself and figure it out from there. int main()...

  • Write a python code that takes in an number 0-9 and prints out the word of...

    Write a python code that takes in an number 0-9 and prints out the word of the number. For example 1 would print out one. Below is the skeleton of the code that needs to be filled in. def num2string(num): """ Takes as input a number, num, and returns the corresponding name as a string. Examples: num2string(0) returns "zero", num2string(1)returns "one" Assumes that input is an integer ranging from 0 to 9 """ numString = "" ################################### ### FILL IN...

  • The skeleton code (starter file) for the problem is pasted below: def phoneNumber(letters): result = ""...

    The skeleton code (starter file) for the problem is pasted below: def phoneNumber(letters): result = "" # ADD YOUR CODE HERE return result def loadEvents(filename): events = {} # ADD YOUR CODE HERE return events def timeline(events): # ADD YOUR CODE HERE return # DO NOT modify or remove the code below! We will use it for testing. if __name__ == "__main__": # Problem 1: Decoding Telephone Numbers ph = input("Enter the text to translate: ") print("The corresponding phone number...

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
Active Questions
ADVERTISEMENT