Advertisement
lyubov_gencheva

Exams_Lab_01_sino_the_walker

Feb 21st, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import datetime
  2.  
  3. leave_at = datetime.datetime.strptime(input(), '%H:%M:%S')
  4. nr_steps, sec_per_step = int(input()), int(input())
  5. time_needed_in_secs = nr_steps * sec_per_step
  6. # module (60*60*24 -> secs a 24-hour day) will calculate the additional seconds fitting in a single 24-hour day
  7. secs_fit_in_one_day_only = time_needed_in_secs % (60*60*24)
  8. seconds_to_add = datetime.timedelta(seconds = secs_fit_in_one_day_only) # timedelta allows addition between two datetime objects
  9. arrive_at = leave_at + seconds_to_add
  10. print(f"Time Arrival: {arrive_at.time()}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement