Python Coding Problem- How To Convert Seconds Into Minutes, Hours, And Day?

Joined
Oct 3, 2012
Messages
3
Reaction score
0
I would like to create a program to convert seconds into minutes, hours, and day in python.

my function:

def time_values(total_seconds):
number_of_minutes=total_seconds//60
number_of_hours=total_seconds//3600
number_of_days=total_seconds//86400
return number_of_minutes, number_of_hours, number_of_days

in another module:

seconds=int(input('Enter the number of seconds:').strip())
minutes=q2_functions.time_values(seconds)
hours=q2_functions.time_values(seconds)
days=q2_functions.time_values(seconds)
print('{0} seconds is equal to {1} minute(s), {2} hour(s), and {3} day(s).'.format(seconds,minutes,hours,days))


These are the outputs I got:
Enter the number of seconds:86400
86400 seconds is equal to (1440, 24, 1) minute(s), (1440, 24, 1) hour(s), and (1440, 24, 1) days(s)

These are the outputs I want:
86400 seconds is equal to 1440 minute(s), 24 hour(s), and 1 day(s).

What am I doing wrong? Thanks for your help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top