Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- hour = int(input())
- min = int(input())
- arrivedhour = int(input())
- arrivedmin = int(input())
- exam_time = hour * 60 + min
- arrived_time = arrivedhour * 60 + arrivedmin
- time_difference = abs(arrived_time-exam_time)
- if arrived_time == exam_time:
- print("On time")
- elif arrived_time < exam_time and time_difference <= 30:
- print("On time")
- print(f"{time_difference} minutes before the start")
- elif arrived_time < exam_time and time_difference > 30 and time_difference < 60:
- print("Early")
- print(f"{time_difference} minutes before the start")
- elif arrived_time < exam_time and time_difference >= 60:
- print("Early")
- hours = math.floor(abs(arrived_time - exam_time) // 60)
- minutes = abs(arrived_time - exam_time) % 60
- if minutes < 10:
- print(f"{hours}:0{minutes} hours before the start")
- else:
- print(f"{hours}:{minutes} hours before the start")
- elif arrived_time > exam_time:
- print("Late")
- if abs(arrived_time-exam_time) < 60:
- print(f"{abs(arrived_time-exam_time)} minutes after the start")
- else:
- hours = math.floor(abs(arrived_time-exam_time)//60)
- minutes = abs(arrived_time-exam_time) %60
- if minutes < 10:
- print(f"{hours}:0{minutes} hours after the start")
- else:
- print(f"{hours}:{minutes} hours after the start")
Advertisement
Add Comment
Please, Sign In to add comment