1answer.
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
gavmur [86]
3 years ago
12

Write a program that estimates the approximate number of times the user’s heart has beat in his/her lifetime using an average he

art rate of 72 beats per minute and estimates the number of times the person has yawned in his/her lifetime using an average of 5 yawns per day. The program should have two functions, heartbeats(age) and yawns(age), that take age in years as an input parameter and returns the estimated number of heartbeats and the number of yawns, respectively. In your computation ignore the leap years.
Computers and Technology
1 answer:
kondor19780726 [428]3 years ago
7 0

Answer:

The code snippet given in python for resolve this question is the following:

import datetime

currentYear = datetime.date.today().year

def heartbeats(age):

 av = 72 * 60 * 24 * 365

 for i in range(currentYear - age - 1, currentYear + 1):

   if is_leap(i):

     av += av

   else:

     pass

 return av

def yawns(age):

 av = 5 * 365

 for i in range(currentYear - age - 1, currentYear + 1):

   if is_leap(i):

     av += av

   else:

     pass

 return av

def is_leap(year):

 if (( year%400 == 0)or (( year%4 == 0 ) and ( year%100 != 0))):

   return True

 else:

   return False

print("Heartbeats: {}, yawns: {}".format(heartbeats(23),yawns(23)))

Explanation:

We have defined 3 functions:

  • def heartbeats(age): Takes the average  heartbeats of a year and sum a acumulative varible(av) when the year is not leap. Return av value.
  • def yawns(age): Takes the average yawns of a year and sum a acumulative variable(av) when the year is not leap. Return av value.
  • def is_leap(year): Return true if is a leap year and false if not.
  • print("Heartbeats: {}, yawns: {}".format(heartbeats(23),yawns(23))). Print the output of the called functions(heartbeats and yawns) for the inserted age (23).
You might be interested in
Given the data model, what would a CROSS JOIN
natta225 [31]

Every combination of each genre with each instrument, even those that are not represented in the genre_instrument table

Explanation:

The CROSS JOIN clause creates a combination of every row from two or more different tables. Determining the number of results in a result set for a CROSS JOIN is as simple as the product of the number of records in each table. 

3 0
2 years ago
Print "userNum1 is negative." if userNum1 is less than O. End with newline Convert userNum2 to 0 if userNum2 is greater than 8.
Butoxors [25]

Answer:

import java.util.Scanner;

public class num1 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter User name 1 and 2");

       int userNum1 = in.nextInt();

       int userNum2= in.nextInt();

       if(userNum1<0){

           System.out.println("userNum1 is negative.");

       }

       else if(userNum2>8){

           userNum2 =0;

       }

       else{

           System.out.println("userNum2 is less than or equal to 8..");

       }

   }

}

Explanation:

This is implemented in Java programming language

Using the scanner class, the user is prompted to enter two numbers

These are saved in the variable userNum1 and userNum2 respectively.

If, else if and else statements are then used according to the specifications given in the question.

8 0
4 years ago
1. Which is a drawback of point-and shoot cameras?
andrezito [222]
1. D you can't change the lens. Point and shoot cameras have a fixed lens so you don't need to change them.

2. C D-SLR. They have fast shutter and focus speeds for photography. They are used in a lot of professional settings. 
6 0
3 years ago
The device used to control a heating system in the home is called a thermostat.
Makovka662 [10]
<span>The device used to control a heating system in the home is called a thermostat.
This is a true statement.
</span>
3 0
4 years ago
Which design principle indicates that a project is visually satisfying
joja [24]

Answer: harmony

Explanation:

Took the test on gmetrix ;)

6 0
3 years ago
Other questions:
  • The ______________ steps through the source code, converting each source code instruction into appropriate machine language foll
    7·1 answer
  • Which domain ending can only be used by educational institutions?
    12·1 answer
  • What variation of a dictionary attack involves a dictionary attack combined with a brute force attack, and will slightly alter d
    5·1 answer
  • Specify either "Write Through" or "Write Back" as the policy which best corresponds to each of the conditions below.
    8·1 answer
  • Do most good businesses have to deal with conflict
    7·1 answer
  • An example of a _________________ impact is when a consumer wants to buy a product on the internet but is afraid the company won
    8·2 answers
  • Write a program that requests the user input a word, then prints every other letter of the word starting with the first letter.
    5·1 answer
  • Assembly language program wich indetify largest number from the five elements 51,44,67,30,99​
    13·1 answer
  • What problems might scientists encounter in using this ethod in the field that you would not have encountered in the simunlation
    13·1 answer
  • What message did vera mukhina convey in her work entitled the worker and the collective farmworker?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!