Develop a program that begins by reading a number of seconds from the user. Then your program should display the equivalent amount of time in the form D:HH:MM:SS, where
D, HH, MM, and SS represent days, hours, minutes and seconds respectively.
The hours, minutes and seconds should all be formatted so that they occupy exactly two digits, with a leading 0 displayed if necessary.
sec=int(input("Enter the number of seconds : ")) days=(sec//(24*3600)) hrs=int((sec%(24*3600))/3600) minutes=int((sec%3600)/60) seconds=int(sec%60) print("The Duration is {} days {} hours {} minutes {} seconds".format(days,hrs,minutes,seconds))
Input_1:
Enter the number of seconds : 563685
Output:
The Duration is 6 days 12 hours 34 minutes 45 seconds
Input_2:
Enter the number of seconds : 851005
Output:
The Duration is 9 days 20 hours 23 minutes 25 seconds
Exec. on linux
Morae!Q!
- Insert and Extend in list
- Interchange first and last number in list
- Print Odd Numbers in range
- Compare List in python
- Find whether the largest element in the array is at least twice as much as every other number in the array.
- Find minimum cost to reach the top of the floor
- Word Count in Python
- Lower case to upper case in python
- Display Time in python
- Sum of Odd And Even in Python
- Surface Area of Walls
- Find the sum of squares of individual digits
- Print the given series – 1 1 2 6 24
- Minimum number of steps required to reach destination.
- Seconds to Days Hours Minutes
- Program to remove add “Hyphen” character in the entered string
- Remove the nth Index Character from a Non-Empty String
- Relational operator Question
- Check whether all the given numbers lies in range of x and y.
- Find the Armstrong numbers between the given range.