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
Which of the following actions can NEGATIVELY impact your credit score?
Tresset [83]
The answer to the question stated above is "<span>forget to pay the cable bill"
>Payment history influences your credit score the most.

Here are the following choices to this question:
</span><span> A-dispute an item on your credit report 
B- forget to pay the cable bill 
C- pay all bills in cash 
D- use small amount of your available credit</span>
3 0
3 years ago
Term of The surroundings and conditions of your workplace
Ainat [17]

Answer:

what

Explanation:

uhh this isnt complete or something i dont know what this is im gonna answer it for the points

8 0
2 years ago
A leading global vendor of computer software, hardware for computer, mobile and gaming systems, and
V125BC [204]

Answer:

Microsoft

Explanation:

5 0
2 years ago
Will this solution really fix the problem?
vova2212 [387]

Answer:

yes it will

Explanation:

6 0
2 years ago
you'll be organizing the various databases in your organization, and have recommended hiring a/an?A. internet specialist B. comp
jek_recluse [69]
Either c or d, most probably D
7 0
3 years ago
Read 2 more answers
Other questions:
  • What privacy issues have arisen with webcams in mobile devices?
    8·1 answer
  • Do you believe that OOP should be phased out and we should start working on some alternative
    6·1 answer
  • Which of the following is not a general strategy for organizing and analyzing qualitative data?a.Convert the data into one or mo
    6·1 answer
  • List and explain the error in the code
    14·1 answer
  • The font color grid is located in the color group on the design tab. (points : 2) true false
    9·1 answer
  • A single-user database system automatically ensures ____ of the database, because only one transaction is executed at a time.
    13·1 answer
  • True or false when a host gets an IP address from a DHCP server it is said to be configured manually
    15·1 answer
  • Help plz
    10·1 answer
  • Does anyone know 7.1.3: Firework karel?
    5·1 answer
  • What code would you use to create the login button?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!