Advertisement
Guest User

Untitled

a guest
Oct 26th, 2015
405
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. ##Write a function, which takes a non-negative integer (seconds) as input and returns the time in a human-readable format (HH:MM:SS)
  2. # HH = hours, padded to 2 digits, range: 00 - 99
  3. # MM = minutes, padded to 2 digits, range: 00 - 59
  4. # SS = seconds, padded to 2 digits, range: 00 - 59
  5. # The maximum time never exceeds 359999 (99:59:59)
  6. # You can find some examples in the test fixtures.
  7.  
  8. def make_readable(seconds):
  9.     m,s = divmod(seconds, 60)
  10.     h, m = divmod(m, 60)
  11.     return "{:02d}:{:02d}:{:02d}".format(h, m ,s)
  12.  
  13.  
  14. print(make_readable(33939))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement