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
What is a motherboard​
aleksandr82 [10.1K]

Answer:

A motherboard is the main printed circuit board in general-purpose computers and other expandable systems. It holds and allows communication between many of the crucial electronic components of a system

Explanation:

8 0
2 years ago
What is the name of the file manager in microsoft windows?
Ivan
It is called Windows Explorer referred as explorer.exe<span />
7 0
3 years ago
Read 2 more answers
What type of storage drive contains multiple spinning platters?
Gala2k [10]

The type of storage drive that contains multiple spinning platters is called; Hard disk drives

<h3>What is the hard disk drive?</h3>

A computer hard disk drive (HDD) is a non-volatile data storage device. Non-volatile refers to storage devices that maintain stored data when turned off.

Now, the correct answer to the question is hard disk drives. This is because a hard disk drive is comprised of a stack of spinning metal disks known as platters. Each spinning disk has trillions of tiny fragments that could possibly be magnetized in order to represent bits (1s and 0s in binary code).

Read more about Hard disk drives at; brainly.com/question/24498473

#SPJ12

8 0
2 years ago
How many possible mac addresses are there?
oksian1 [2.3K]
There are 6 octects ( 8 bit numbers ) in a MAC address, so there's 256^6 possible addresses.
6 0
3 years ago
JavaScript is the same thing as Java?
Mila [183]

Not really, because Java is an OOP programming language and JavaScript is an OOP scripting language.

Hope I helped!

~Mshcmindy

5 0
2 years ago
Read 2 more answers
Other questions:
  • The process of making raw materials into a finished product is known as
    14·2 answers
  • Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
    15·1 answer
  • If a user has just added a simple triangle shape into a diagram, how can the triangle be adjusted? Check all that apply. by maki
    6·2 answers
  • Write a C++ program that determines if a given string is a palindrome. A palindrome is a word or phrase that reads the same back
    6·1 answer
  • If you see an advertisement for a 3TB portable drive, this is most likely a reference to the device having a capacity of three
    10·1 answer
  • Who has access to the source code of proprietary software
    6·1 answer
  • What is motivation and state the two forms​
    14·1 answer
  • Complete the sentence.<br> Python is a_____<br> level language compared to bytecode.
    7·2 answers
  • A common hardware component found in electronic devices including desktop computers, laptops, tablets and smartphones. The amoun
    5·1 answer
  • This is a graded practice activity. This is not an actual quiz.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!