Advertisement
veronikaaa86

08. On Time for the Exam

May 22nd, 2022
1,295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. exam_hour = int(input())
  2. exam_min = int(input())
  3. arrival_hour = int(input())
  4. arrival_min = int(input())
  5.  
  6. exam_all_min = (exam_hour * 60) + exam_min
  7. arrival_all_min = (arrival_hour * 60) + arrival_min
  8.  
  9. diff = abs(exam_all_min - arrival_all_min)
  10. if arrival_all_min > exam_all_min:
  11.     print("Late")
  12.     if diff < 60:
  13.         print(f"{diff} minutes after the start")
  14.     else:
  15.         hour = diff // 60
  16.         min = diff % 60
  17.         if min < 10:
  18.             print(f"{hour}:0{min} hours after the start")
  19.         else:
  20.             print(f"{hour}:{min} hours after the start")
  21. elif arrival_all_min == exam_all_min or diff <= 30:
  22.     print("On Time")
  23.     if 1 <= diff <= 30:
  24.         print(f"{diff} minutes before the start")
  25. else:
  26.     print("Early")
  27.     if diff < 60:
  28.         print(f"{diff} minutes before the start")
  29.     else:
  30.         hour = diff // 60
  31.         min = diff % 60
  32.         if min < 10:
  33.             print(f"{hour}:0{min} hours before the start")
  34.         else:
  35.             print(f"{hour}:{min} hours before the start")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement