answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
siniylev [52]
2 years ago
12

#Imagine you're writing some code for an exercise tracker. #The tracker measures heart rate, and should display the #average hea

rt rate from an exercise session. # #However, the tracker doesn't automatically know when the #exercise session began. It assumes the session starts the #first time it sees a heart rate of 100 or more, and ends #the first time it sees one under 100. # #Write a function called average_heart_rate. #average_heart_rate should have one parameter, a list of #integers. These integers represent heart rate measurements #taken 30 seconds apart. average_heart_rate should return #the average of all heart rates between the first 100+ #heart rate and the last one. Return this as an integer #(use floor division when calculating the average). # #You may assume that the list will only cross the 100 beats #per minute threshold once: once it goes above 100 and below #again, it will not go back above.
Computers and Technology
1 answer:
xeze [42]2 years ago
8 0

Answer:

Following are the code to this question:

def average_heart_rate(beats):#defining a method average_heart_rate that accepts list beats  

   total=0 #defining integer variable total,that adds list values  

   count_list=0#defining a count_list integer variable, that counts list numbers  

   for i in beats:#defining for loop to add list values  

       if i>= 100:#defining if block to check value is greater then 100

           total += i#add list values

           count_list += 1# count list number  

   return total//count_list #return average_heart_rate value  

beats=[72,77,79,95,102,105,112,115,120,121,121,125, 125, 123, 119, 115, 105, 101, 96, 92, 90, 85]#defining a list

print("The average heart rate value:",average_heart_rate(beats)) # call the mnethod by passing value

Output:

The average heart rate value: 114

Explanation:

In the given question some data is missing so, program description can be defined as follows:

  • In the given python code, the method "average_heart_rate" defined that accepts list "beats" as the parameter, inside the method two-variable "total and count_list " is defined that holds a value that is 0.
  • In the next line, a for loop is that uses the list and if block is defined that checks list value is greater then 100.
  • Inside the loop, it calculates the addition and its count value and stores its values in total and count_list  variable, and returns its average value.
You might be interested in
Which option describes wearable technology?
kotykmax [81]
My opinion is the answers A and D. I would choose A if you can only choose one, though.
7 0
2 years ago
Read 2 more answers
Which of the following are recommended techniques for protecting computer files and data? Check all of the boxes that apply.
lara [203]
Hello <span>Pouerietzach


Question: </span><span>Which of the following are recommended techniques for protecting computer files and data? Check all of the boxes that apply.
</span><span>
Answer: A, B, D, E, G

Hope That Helps
-Chris</span>
5 0
2 years ago
Read 2 more answers
What is a typical grace period for a credit card...
Schach [20]
It is 20 to 25 days so c is correct
6 0
2 years ago
Read 2 more answers
When you use a while loop to compute the product of several values, you should initialize the variables holding the product to _
Allushta [10]

Answer:

b.1

Explanation:

When we are using while loop to compute the product of several values we need to initialize the value holding the product to 1 because when we multiply something with 1 it will give the same number.

If we initialize it with 0 the product will come out to be 0 because  anything multiplied by 0 is 0.

we cannot initialize it with NULL because it is not a pointer.

We need to initialize the number since it contains garbage values so it will give product with that value.

3 0
2 years ago
Write the definition of a function power_to, which receives two parameters. The first is a float and the second is an integer. T
Ber [7]

Answer:

  1.    public static double power_2(double num1, int num2){
  2.        if(num2<0){
  3.            return 0;
  4.        }
  5.        else{
  6.            double returnedVal = Math.pow(num1,num2);
  7.            return returnedVal;
  8.        }
  9.    }

Explanation:

  • This is implemented in Java programming language
  • Line 1 Is the method declaration which indicates that it will return a floating point number (type double) and accepts two parameters, the first a double and the second an int as required by the question
  • Line 2 Uses and if statement to check if the second parameter is negative (less than 0) and returns 0.0 if this is true
  • Lines 5-7 is the else condition that uses java's Math.pow method to raise the num1 to the power num2 and returns the value
3 0
2 years ago
Other questions:
  • True or false? The largest component of a database is a field.
    12·2 answers
  • Grabar microphone audio icon_person click each item to hear a list of vocabulary words from the lesson. then, record yourself sa
    7·2 answers
  • Seneca has just applied conditional formatting and realizes that she has made a mistake. Which action should she take to fix the
    12·1 answer
  • Which of the following describes ETL? a) A process that transforms information using a common set of enterprise definitions b) A
    14·1 answer
  • In evaluating the precedence rules used by Python, what statement is accurate? a. Addition and subtraction are evaluated after a
    8·2 answers
  • A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
    10·1 answer
  • Liz's meeting is scheduled to end at 9:30. It is 9:20 and team
    11·1 answer
  • Sara is using her personal laptop (which is password protected) at a "hotspot" at a local cafe with wifi access. She is in the m
    7·1 answer
  • If a class has member variables that are pointers, you must ensure that you implement ____.
    6·1 answer
  • #Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!