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
Which of the following is not a benefit of shaping data with the Power Query Editor?
algol13

Answer:

A

Explanation:

I am not 100% sure but without the shaping data, data can still be merged from multiple sources.

3 0
2 years ago
Subscript numbering always starts at what value?
Leni [432]
It always starts with 0
4 0
3 years ago
Question 4
Tcecarenko [31]

Answer: squared ← number * number

Explanation:

4 0
3 years ago
The commands available here change depending on the activity taking place in the presentation window's main work area.
pickupchik [31]

task pane is correct!

7 0
3 years ago
Read 2 more answers
Which hardware device connects your network to the internet?
pentagon [3]
The Ethernet Cord 

Hope this helps,

kwrob :)

6 0
3 years ago
Other questions:
  • HEY DO U LIKE TRAINS!
    7·1 answer
  • Select all that apply.
    15·2 answers
  • The part of the computer that provides access to the internet is the?
    14·1 answer
  • What is the sum of each pair of binary integers? (assuming 8-bit register is used)
    5·1 answer
  • What are the advantages of businesses using Twitter ?
    12·1 answer
  • Write a method called sum with a while loop that adds up all numbers between two numbers a and b. The values for a and b can be
    11·2 answers
  • Define a new class Fighter that inherits from Spaceship. Add a variable property weapon that defaults to an empty string and a v
    14·1 answer
  • A spreadsheet contains the maximum weight and maximum height for fifty dog breeds. The breeds are located in rows, and the weigh
    5·1 answer
  • If a folder exists on an NTFS partition, which permission is needed by a user who needs to set security permissions on the folde
    11·1 answer
  • What does the top level domain in a url inducate? A. The organization or company that owns the website. B. The organization or c
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!