Advertisement
veronikaaa86

08. On Time for the Exam

Mar 13th, 2022
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. exam_hour = int(input())
  2. exam_min = int(input())
  3. hour_of_arrival = int(input())
  4. min_of_arrival = int(input())
  5.  
  6. exam_time_min = (exam_hour * 60) + exam_min
  7. arrival_time_min = (hour_of_arrival * 60) + min_of_arrival
  8.  
  9. diff_min = abs(exam_time_min - arrival_time_min)
  10.  
  11. if exam_time_min < arrival_time_min:
  12. print("Late")
  13. if diff_min >= 60:
  14. hour = diff_min // 60
  15. minutes = diff_min % 60
  16. if minutes < 10:
  17. print(f"{hour}:0{minutes} hours after the start")
  18. else:
  19. print(f"{hour}:{minutes} hours after the start")
  20. else:
  21. print(f"{diff_min} minutes after the start")
  22. elif exam_time_min == arrival_time_min or diff_min <= 30:
  23. print("On time")
  24. if diff_min >= 1 and diff_min <= 30:
  25. print(f"{diff_min} minutes before the start")
  26. else:
  27. print("Early")
  28. if diff_min >= 60:
  29. hour = diff_min // 60
  30. minutes = diff_min % 60
  31. if minutes < 10:
  32. print(f"{hour}:0{minutes} hours before the start")
  33. else:
  34. print(f"{hour}:{minutes} hours before the start")
  35. else:
  36. print(f"{diff_min} minutes before the start")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement