Question: In python 3 Write a function that given a number of seconds, return the days, hours, minutes, and seconds it represents. For example if the

In python 3

 In python 3 Write a function that given a number of

Write a function that given a number of seconds, return the days, hours, minutes, and seconds it represents. For example if the function is called with 99061 seconds it should output: days:1, hours:3, minutes:31, seconds: 1 The basic approach is to find out how many days first by dividing by the number of seconds in a day. Next get the remaining seconds by using the remaindering operator '%'. days = seconds // seconds in one day # integer divide seconds = seconds % seconds in one day # remainder left over # similar for calculating hours # similar for calculating days The function should return a string. If 79061 is the input the returned string should be: days:0, hours:21, minutes:57, seconds:41' Your output should match exactly the formatting of the output above, one space after the commas. Save & Run Original - 1 of 1 Show Feedback Hide Code Show CodeLens 1 def seconds_to_day_hr_min_sec (seconds) : W NA # your code here 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!