Advertisement
Tsenkov

08. On Time for the Exam

Aug 6th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.28 KB | None | 0 0
  1. exam_hour = int(input())
  2. exam_minutes = int(input())
  3. hour_to_arrive = int(input())
  4. minutes_to_arrive = int(input())
  5. exam_time = exam_hour *  60 + exam_minutes
  6. arive_time = hour_to_arrive * 60 + minutes_to_arrive
  7. if exam_time < arive_time:
  8.     if arive_time - exam_time < 60:
  9.         print(f"Late\n{arive_time - exam_time} minutes after the start")
  10.     elif arive_time - exam_time > 59:
  11.         if (arive_time - exam_time % 60) < 10:
  12.             print(f"Late\n{(arive_time - exam_time) // 60}:0{(arive_time - exam_time) % 60} hours after the start")
  13.         else:
  14.             print(f"Late\n{(arive_time - exam_time) // 60}:{(arive_time - exam_time) % 60} hours after the start")
  15. elif exam_time == arive_time or exam_time - arive_time <= 30:
  16.  
  17.     print(f"On time\n{(exam_time - arive_time) % 60} minutes before the start")
  18. else:
  19.     if exam_time - arive_time < 60:
  20.         print(f"Early\n{(exam_time - arive_time) % 60} minutes before the start")
  21.     elif exam_time - arive_time > 59:
  22.         if ((exam_time - arive_time) % 60) < 10:
  23.             print(f"Early\n{(exam_time - arive_time) // 60}:0{(exam_time - arive_time) % 60} hours before the start")
  24.         else:
  25.             print(f"Early\n{(exam_time - arive_time) // 60}:{(exam_time - arive_time) % 60} hours before the start")
  26.  
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement