ivantanchev

exam_time

Mar 13th, 2022
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. exam_hour = int(input())
  2. exam_min = int(input())
  3. hour_arrival = int(input())
  4. min_arrival = int(input())
  5.  
  6. exam_time_min = (exam_hour * 60) + exam_min
  7. arrival_time_min = (hour_arrival * 60) +min_arrival
  8.  
  9. diff = abs(exam_time_min-arrival_time_min)
  10. if exam_time_min < arrival_time_min:
  11.     print("Late")
  12.     if diff < 60:
  13.         print(f"{diff} minutes after the start")
  14.     elif diff >= 60:
  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.  
  22. elif exam_time_min == arrival_time_min or diff <= 30:
  23.     print("On time")
  24.     if diff >=1 and diff <=30:
  25.         print(f"{diff} minutes before the start")
  26. else:
  27.     print("Early")
  28.     if diff < 60:
  29.         print(f"{diff} minutes before the start")
  30.     elif diff >= 60:
  31.         hour = diff // 60
  32.         min = diff % 60
  33.         if min < 10:
  34.             print(f"{hour}:0{min} hours before the start")
  35.         else:
  36.             print(f"{hour}:{min} hours before the start")
  37.  
  38.  
  39.  
Advertisement
Add Comment
Please, Sign In to add comment