- 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.
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.