Write a program that asks the user to enter a number of seconds, and works as follows:
• There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds.
• There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds.
• There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days in that many seconds.
COMPLETE PROGRAM CODE:
# Ask user to enter a number of seconds
seconds = int(input("Please enter a number of seconds: "))
# Calculate the number of minutes, hours, and days in the number of seconds
minutes = seconds / 60
hours = seconds / 3600
days = seconds / 86400
# Display the results
if seconds >= 86400:
print(str(seconds) + " seconds is equal to " + str(days) + " days")
elif seconds >= 3600:
print(str(seconds) + " seconds is equal to " + str(hours) + " hours")
elif seconds >= 60:
print(str(seconds) + " seconds is equal to " + str(minutes) + " minutes")
else:
print("No conversion necessary.")
OUTPUT 1:
Please enter a number of seconds: 240000
240000 seconds is equal to 2.7777777777777777 days
OUTPUT 2:
Please enter a number of seconds: 432000
432000 seconds is equal to 5.0 days