Advertisement
veronikaaa86

08. On Time for the Exam

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