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
If you want to wrap text so that it fits a particular cell size, which formatting section would you use?
Pavlova-9 [17]

You would use the formatting section of alignment.

7 0
3 years ago
Read 2 more answers
Need deveolpers not software
ivolga24 [154]
Developers? For what?
3 0
4 years ago
Read 2 more answers
Can someone help me with this
Alex787 [66]
I’m not sure but I think it belongings.
5 0
3 years ago
What is the first step in creating a maintenance ?
tankabanditka [31]
The first step would be knowing the manufacturer s recommended schedule for maintenance
7 0
3 years ago
Vivek wants to save the data about his grocery store in a single table. Which among the following type of databases is used in t
Orlov [11]

Explanation:

A centralized database (sometimes abbreviated CDB) is a database that is located, stored, and maintained in a single location.

4 0
3 years ago
Other questions:
  • Landon starts his computer and receives the error message, "Hard drive is not found." In a panic, he calls you because he did no
    14·2 answers
  • WHAT IS SQL AND HOW CAN YOU MEET THE DATA REQUIREMENTS ALSO MAINTAINING DATA INTEGRITY,AND LASTLY STATE THE FULL MEANING OF SQL
    11·1 answer
  • Describe software as a service. what features distinguish it from application software installed on a personal computing device
    11·2 answers
  • Write a program that will open the file random.txt and calculate and display the following: A. The number of numbers in the file
    12·1 answer
  • The cord of a bow string drill was used for
    14·1 answer
  • Can someone please give me example of three types of loop in pascal (It has to has randomize in it too)
    15·1 answer
  • All of the following are true of using the database approach to managing data except Group of answer choices Decentralized manag
    6·1 answer
  • Cho 3 lớp như hình, viếtchương trình thực hiện các chức năng sau:
    15·1 answer
  • The term information technology was first used what year?
    15·2 answers
  • What is a simple definition for electricity?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!