Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- exam_hour = int(input())
- exam_minutes = int(input())
- arrival_hour = int(input())
- arrival_minutes = int(input())
- time_exam_in_minutes = exam_hour * 60 + exam_minutes
- time_arrival_minutes = arrival_hour * 60 + arrival_minutes
- time_before = 0
- time_after = 0
- if time_arrival_minutes == time_exam_in_minutes:
- print('On time')
- elif time_arrival_minutes <= time_exam_in_minutes and time_exam_in_minutes - time_arrival_minutes <= 30:
- time_before = time_exam_in_minutes - time_arrival_minutes
- print('On time')
- print(f'{time_before} minutes before the start')
- elif time_exam_in_minutes < time_arrival_minutes:
- print('Late')
- time_after = time_arrival_minutes - time_exam_in_minutes
- if time_after <= 59:
- print(f'{time_after} minutes after the start')
- else:
- hour = math.floor(time_after / 60)
- minutes = time_after % 60
- if minutes <= 9:
- print(f'{hour}:0{minutes} hours after the start')
- else:
- print(f'{hour}:{minutes} hours after the start')
- elif time_arrival_minutes < time_exam_in_minutes:
- print('Early')
- time_before = time_exam_in_minutes - time_arrival_minutes
- if 30 < time_before <= 59:
- print(f'{time_before} minutes before the start')
- elif time_before > 59:
- hour = math.floor(time_before / 60)
- minutes = time_before % 60
- if minutes <= 9:
- print(f'{hour}:0{minutes} hours before the start')
- else:
- print(f'{hour}:{minutes} hours before the start')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement