Advertisement
Guest User

time

a guest
Jan 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. # read hours, minutes, seconds
  2. # convert hours + minutes + seconds to totalSeconds
  3. # convert totalSeconds back to hours + minutes + seconds
  4. import datetime
  5.  
  6.  
  7. hours = int(input("Please enter amount of hours: \n"))
  8. minutes = int(input("Please enter amount of minutes: \n"))
  9. seconds = int(input("Please enter amount of seconds \n"))
  10. totalSeconds = ((hours * 3600) + (minutes * 60) + seconds)
  11.  
  12. print("The total amount of seconds is:", totalSeconds, "\n")
  13.  
  14. originalTime = print(totalSeconds, "seconds in hh:mm:ss format is", str(datetime.timedelta(seconds = totalSeconds)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement