# Convert Days, Hours, Minutes into Seconds

Develop a program that reads the number of days, hours, minutes, and seconds from the user. Calculate and display the total number of seconds represented by that duration.

Load your favorite IDEs on the cloud & code on the go with virtual desktops remotely from your preferred mobile devices (iOS/Android/PC) with CloudDesktopOnline.com. For effective team collaboration use a hosted SharePoint and exchange from Apps4Rent

## #Python's program to convert number of days, hours, minutes and seconds to seconds. ## #Define the constants SECONDS_PER_MINUTE = 60 SECONDS_PER_HOUR = 3600 SECONDS_PER_DAY = 86400 #Read the inputs from user days = int(input("Enter number of Days: ")) hours = int(input("Enter number of Hours: ")) minutes = int(input("Enter number of Minutes: ")) seconds = int(input("Enter number of Seconds: ")) #Calculate the days, hours, minutes and seconds total_seconds = days * SECONDS_PER_DAY total_seconds = total_seconds + ( hours * SECONDS_PER_HOUR) total_seconds = total_seconds + ( minutes * SECONDS_PER_MINUTE) total_seconds = total_seconds + seconds #Display the result print("Total number of seconds: ","%d"%(total_seconds))

###### Sample output of above program.

C:\Python\programs>python program.py

Enter number of Days: 5

Enter number of Hours: 36

Enter number of Minutes: 24

Enter number of Seconds: 15

Total number of seconds: 563055

C:\Python\programs>

Enter number of Days: 5

Enter number of Hours: 36

Enter number of Minutes: 24

Enter number of Seconds: 15

Total number of seconds: 563055

C:\Python\programs>

2018-02-17T05:38:05+05:30
2018-02-17T05:38:05+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution