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
velikii [3]
3 years ago
7

Complete the function ending_time that determines the final clock time after a task has been completed. The function takes three

arguments that provide the current time of day, as well as the total time in seconds that it will take to complete the task: hour: the current hour of the day (0 - 23) minute: the current minute of the day (0 - 59) second: the current second of the day (0 - 59) time_taken: the number of seconds it will take to complete the task (greater than 0) Assume all inputs are valid. time_taken can be arbitrarily large! As an example, consider the test case: 2, 59, 40, 22. This means that the current hour is 2, the current minute is 59, the current second is 40, and the time to complete the task is 22 seconds. So the first three function arguments represent the time 2:59:40 am.
Computers and Technology
1 answer:
Ivanshal [37]3 years ago
8 0

Answer:

  1. def ending_time(hour, minutes, seconds, work_time):
  2.    if((seconds + work_time) // 60 > 0):
  3.        minutes = minutes + (seconds + work_time) // 60
  4.        seconds = (seconds + work_time) % 60    
  5.        if(minutes // 60 > 0):
  6.            hour = hour + (minutes // 60)
  7.            minutes = minutes % 60
  8.    else:
  9.        seconds = seconds + work_time  
  10.    return str(hour) + ":" + str(minutes) + ":" + str(seconds)
  11. print(ending_time(2,30,59, 12000))

Explanation:

The solution code is written in Python 3.

Firstly create a function ending_time that takes the four required input parameters.

Next, create an if statement to check if the numerator of (seconds + work_times) divided by 60 is over zero. If so, increment the minute and reassign the remainder of the seconds to the variable (Line 2-4).

Next, create another if statement again to check if the numerator of (current minutes) divided by 60 is over zero, if so increment the hour and reassign the remainder of the minutes to the variable (Line 6-8)

Otherwise, just simply add the work_time to the current seconds

At last return the time output string (Line 12).

You might be interested in
How to do a Spreadsheet ??
sveticcg [70]

Answer:

Open Microsoft spreadsheet then input the data to the computer

3 0
3 years ago
Search engines use indexes created by web _________ to provide fast searches.
Nastasia [14]
Search engines use indexes created by web crawlers to provide fast searches.
3 0
3 years ago
Is it legal to build cellphone tower
Marat540 [252]
If you build a cellphone tower without proper building permits and equipment without permission from local government than it would be illegal
3 0
3 years ago
What file system supported by windows can be used for volumes and drives that don’t hold the windows installation? (choose all t
Vikki [24]

Answer:

What file system supported by Windows can be used for volumes and drives that don't hold the Windows installation? (Choose all that apply.) Correct! Correct. exFAT file system is supported by Windows and is used for large external storage devices that may be used with other operating systems.

Explanation:

8 0
3 years ago
Write the definition of a function, is_reverse, whose two parameters are arrays of integers of equal size. The function returns
Alisiya [41]

Answer:

def is_reverse(lst1, lst2):

   lst2 = lst2[::-1]

   if lst1 == lst2:

       return True

   else:

       return False

Explanation:

Create a function called is_reverse that takes two parameters, lst1 and lst2

Reverse the second list using slicing

Check if the first list and the second list are equal to each other. If they are, return True. Otherwise, return False

4 0
3 years ago
Other questions:
  • Ann wants to create a bookmark. She should
    9·2 answers
  • Which statement is the best description of a value proposition?
    7·2 answers
  • Computer communications describes a process in which two or more computers or devices transfer ____.
    10·1 answer
  • Consolidating a system's physical and time resources is known as ________________.
    13·1 answer
  • Which keyboard feature is a form feed character?
    15·1 answer
  • HELPPPPPPP!!!!!!!!!
    8·1 answer
  • What is one purpose of an essay’s conclusion paragraph?
    13·1 answer
  • FIRST ANSWER GETS BRAINLIEST IM GIVING 30 POINTS!!!! Select the correct answer. Emma's project team has to create an application
    12·1 answer
  • A database admin uses a SHOW statement to retrieve information about objects in a database. This information is contained in a _
    10·1 answer
  • A/an _____________ is a stored program that executes at a specified time. Group of answer choices stored procedure view trigger
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!