Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- start_time = input("Enter the time in format HH:MM:SS: ")
- end_time = input("Enter the time in format HH:MM:SS: ")
- start_seconds = int(start_time[0] + start_time[1]) * 3600 + int(start_time[3] + start_time[4]) * 60 + int(start_time[6] + start_time[7])
- end_seconds = int(end_time[0] + end_time[1]) * 3600 + int(end_time[3] + end_time[4]) * 60 + int(end_time[6] + end_time[7])
- hours = (end_seconds - start_seconds) // 3600
- minutes = ((end_seconds - start_seconds) // 60) % 60
- seconds = (end_seconds - start_seconds) % 60
- print(f"The time that passed is {hours}:{minutes}:{seconds}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement