Advertisement
nq1s788

Untitled

Sep 1st, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. def unify(hour, min, sec=0):
  2.     return (hour * 60 + min) * 60 + sec
  3.  
  4.  
  5. def time(km, sec_per_km):
  6.     return km * sec_per_km
  7.  
  8.  
  9. def add_zero(s):
  10.     return '0' * (2 - len(s)) + s
  11.  
  12.  
  13. def format(cur_time):
  14.     hour = add_zero(str((cur_time // 60 // 60) % 24))
  15.     min = add_zero(str((cur_time // 60) % 60))
  16.     sec = add_zero(str(cur_time % 60))
  17.     return hour + ':' + min + ':' + sec
  18.  
  19.  
  20. start = unify(6, 52)
  21. light = unify(0, 8, 15)
  22. hard = unify(0, 7, 12)
  23. print(format(start + time(1, light) + time(3, hard) + time(1, light)))
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement