rozalina1988

8_On_time_for_exam

Nov 16th, 2024
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. exam_hour = int(input())
  2. exam_minute = int(input())
  3.  
  4. arrival_hour = int(input())
  5. arrival_minute = int(input())
  6.  
  7. #matematica
  8. time_of_exam = exam_hour * 60 + exam_minute
  9. time_of_arrival = arrival_hour * 60 + arrival_minute
  10. difference = abs(time_of_exam - time_of_arrival)
  11. hour = difference // 60
  12. minutes = difference % 60
  13.  
  14. if time_of_exam == time_of_arrival:
  15.      print('On Time')
  16.  
  17. if time_of_exam != time_of_arrival:
  18.     difference = time_of_arrival-time_of_exam
  19.     on_time = "after"
  20.     status = "Late"
  21.  
  22.     if difference < 0:
  23.         on_time = "before"
  24.         if difference >= -30:
  25.             status = "On time"
  26.         else:
  27.             status = "Early"
  28.     print(status)
  29.     if abs(difference) // 60 == 0:
  30.         print(f"{minutes} minutes {on_time} the start")
  31.     else:
  32.         print(f"{hour}:{minutes} hours {on_time} the start")
  33.  
Advertisement
Add Comment
Please, Sign In to add comment