Sichanov

on time

May 27th, 2021
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. import math
  2.  
  3. exam_hour = int(input())
  4. exam_minutes = int(input())
  5.  
  6. arrival_hour = int(input())
  7. arrival_minutes = int(input())
  8.  
  9. total_exam = exam_hour * 60 + exam_minutes
  10. total_arrival = arrival_hour * 60 + arrival_minutes
  11.  
  12. type = ""
  13.  
  14. if total_arrival > total_exam:
  15.     type = "Late"
  16. elif total_arrival + 30 < total_exam:
  17.     type = "Early"
  18. elif total_arrival <= total_exam:
  19.     type = "On time"
  20.  
  21. print(type)
  22.  
  23. difference = abs(total_exam - total_arrival)
  24.  
  25. if total_arrival < total_exam and total_exam - total_arrival >= 60:
  26.  
  27.     print(f"{difference // 60}:{difference % 60:02d} hours before the start")
  28.  
  29. elif total_exam - total_arrival <= 60 and total_arrival < total_exam:
  30.     print(f"{total_exam - total_arrival} minutes before the start")
  31.  
  32. if total_arrival > total_exam and total_arrival - total_exam >= 60:
  33.  
  34.     print(f"{difference // 60}:{difference % 60:02d} hours after the start")
  35.  
  36. elif total_arrival - total_exam <= 60 and total_arrival > total_exam:
  37.     print(f"{total_arrival - total_exam} minutes after the start")
  38.  
Advertisement
Add Comment
Please, Sign In to add comment