Convert seconds to hours and minutes.
★★☆The number of seconds can also be expressed in hours and minutes.
Write a program that allows the user to enter the number of seconds. The program outputs the number of equivalent hours, minutes and seconds that is.
Remember to add a comment before a subprogram, selection or iteration statement to explain its purpose.
seconds_to_hours that:seconds_to_minutes that:seconds_remaining that:Enter the number of seconds: 60
0 hours 1 minutes 0 seconds
Enter the number of seconds: 1460
0 hours 24 minutes 20 seconds
Enter the number of seconds: 86000
23 hours 53 minutes 20 seconds
Enter the number of seconds: 4200
1 hours 10 minutes 0 seconds
# Seconds in a day program
# -------------------------
# Subprograms
# -------------------------
---
# Function to return the number of hours from seconds
def seconds_to_hours(seconds):
---
return seconds // 3600
---
# Function to return the number of minutes from seconds
def seconds_to_minutes(seconds):
---
return (seconds // 60) % 60
---
# Function to reduce the number of seconds after minutes calculated
def seconds_remaining(seconds):
---
return seconds % 60
---
# -------------------------
# Main program
# -------------------------
seconds = int(input("Enter the number of seconds: "))
---
hours = seconds_to_hours(seconds)
minutes = seconds_to_minutes(seconds)
seconds = seconds_remaining(seconds)
---
print(hours, "hours", minutes, "minutes", seconds, "seconds")