Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- leave_at = datetime.datetime.strptime(input(), '%H:%M:%S')
- nr_steps, sec_per_step = int(input()), int(input())
- time_needed_in_secs = nr_steps * sec_per_step
- # module (60*60*24 -> secs a 24-hour day) will calculate the additional seconds fitting in a single 24-hour day
- secs_fit_in_one_day_only = time_needed_in_secs % (60*60*24)
- seconds_to_add = datetime.timedelta(seconds = secs_fit_in_one_day_only) # timedelta allows addition between two datetime objects
- arrive_at = leave_at + seconds_to_add
- print(f"Time Arrival: {arrive_at.time()}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement