Sichanov

ddd

Jan 26th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.21 KB | None | 0 0
  1. hours_1 = int(input())
  2. minutes_1 = int(input())
  3. hours_2 = int(input())
  4. minutes_2 = int(input())
  5.  
  6. hours_3 = (hours_1 * 60) + minutes_1
  7. hours_4 = (hours_2 * 60) + minutes_2
  8. total = hours_3 - hours_4
  9. hh = abs(hours_1 - hours_2)
  10. mm = abs(minutes_1 - minutes_2)
  11.  
  12. if total < 0:
  13.     total = abs(total)
  14.     print(f"Late")
  15.     if 60 > total:
  16.         print(f"{total} minutes after the start")
  17.     elif 60 <= total and (mm >= 10):
  18.         mm = total % 60
  19.         print(f"{hh}:{mm} hours after the start")
  20.     elif 60 <= total and (mm < 10):
  21.         mm = total % 60
  22.         print(f"{hh}:0{mm} hours after the start")
  23. elif 0 <= total <= 30:
  24.     total = abs(total)
  25.     print(f"On time")
  26.     if not total == 0:
  27.         print(f"{total} minutes before the start")
  28. elif 30 < total:
  29.     total = abs(total)
  30.     print(f"Early")
  31.     if 30 < total < 60:
  32.         print(f"{total} minutes before the start")
  33.     elif 60 < total and (mm >= 10):
  34.         hours = total // 60
  35.         minutes = total % 60
  36.         print(f"{hours}:{minutes:0>2d} hours before the start")
  37.     elif 60 <= total and (mm < 10):
  38.         hours = total // 60
  39.         minutes = total % 60
  40.         print(f"{hours}:{minutes:0>2d} hours before the start")
Advertisement
Add Comment
Please, Sign In to add comment