Advertisement
desislava_topuzakova

Untitled

May 8th, 2020
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. import math
  2.  
  3. exam_hour = int(input())
  4. exam_minutes = int(input())
  5. arrival_hour = int(input())
  6. arrival_minutes = int(input())
  7.  
  8. time_exam_in_minutes = exam_hour * 60 + exam_minutes
  9. time_arrival_minutes = arrival_hour * 60 + arrival_minutes
  10. time_before = 0
  11. time_after = 0
  12.  
  13. if time_arrival_minutes == time_exam_in_minutes:
  14. print('On time')
  15. elif time_arrival_minutes <= time_exam_in_minutes and time_exam_in_minutes - time_arrival_minutes <= 30:
  16. time_before = time_exam_in_minutes - time_arrival_minutes
  17. print('On time')
  18. print(f'{time_before} minutes before the start')
  19. elif time_exam_in_minutes < time_arrival_minutes:
  20. print('Late')
  21. time_after = time_arrival_minutes - time_exam_in_minutes
  22. if time_after <= 59:
  23. print(f'{time_after} minutes after the start')
  24. else:
  25. hour = math.floor(time_after / 60)
  26. minutes = time_after % 60
  27. if minutes <= 9:
  28. print(f'{hour}:0{minutes} hours after the start')
  29. else:
  30. print(f'{hour}:{minutes} hours after the start')
  31. elif time_arrival_minutes < time_exam_in_minutes:
  32. print('Early')
  33. time_before = time_exam_in_minutes - time_arrival_minutes
  34. if 30 < time_before <= 59:
  35. print(f'{time_before} minutes before the start')
  36. elif time_before > 59:
  37. hour = math.floor(time_before / 60)
  38. minutes = time_before % 60
  39. if minutes <= 9:
  40. print(f'{hour}:0{minutes} hours before the start')
  41. else:
  42. print(f'{hour}:{minutes} hours before the start')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement