im11

zadacha 8 - "Na vreme za izpit"

Sep 26th, 2021
1,264
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hour_of_examine = int(input())
  2. minutes_of_examine = int(input())
  3. hour_of_arriving = int(input())
  4. minutes_of_arriving = int(input())
  5.  
  6. time_of_examine = hour_of_examine * 60 + minutes_of_examine
  7. time_of_arriving = hour_of_arriving * 60 + minutes_of_arriving
  8.  
  9. difference = time_of_examine - time_of_arriving  # !!! тук е БЕЗ "abs"
  10.  
  11. if difference < 0:
  12.     print('Late')
  13. elif 0 <= difference <= 30:
  14.     print('On time')
  15. else:
  16.     print('Early')
  17.  
  18. hours = abs(difference) // 60
  19. minutes = abs(difference) % 60
  20.  
  21. if 0 < difference < 60:
  22.     print(f'{minutes} minutes before the start')
  23. elif difference >= 60:
  24.     print(f'{hours}:{minutes:02d} hours before the start')
  25. elif -60 < difference <0:
  26.     print(f'{minutes} minutes after the start')
  27. elif difference <= -60:
  28.     print(f'{hours}:{minutes:02d} hours after the start')
RAW Paste Data